Emmett (2)
Usenet Archive
- Joined
- Nov 23, 2002
- Messages
- 104
- Reaction score
- 0
The transform below should create a dropdown where the
entry for "SSS Building I" is selected. (Or am I missing something? )
This transform creates the dropdown but doesn't do the select.
Can "if tests" work when there are spaces?
Thanks
<xml_data>
<building>SSS Building I</building>
</xml_data>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl
utput method="html" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" encoding="UTF-8"/>
<xsl:template match="/">
<select name="building">
<option selected="selected">
<xsl:if test="not(/xml_data/building)">
<xsl:attribute name="selected">selected</xsl:attribute> </xsl:if>Select One </option> <option value="SSS Building I"> <xsl:if test="/xml_data/building='SSS Building I'"> <xsl:attribute name="selected">selected</xsl:attribute> </xsl:if>SSS Building I </option> <option value="SSS Building II"> <xsl:if test="/xml_data/building='SSS Building II'"> <xsl:attribute name="selected">selected</xsl:attribute> </xsl:if>SSS Building II </option> <option value="HHH Building III"> <xsl:if test="/xml_data/building='HHH Building III'"> <xsl:attribute name="selected">selected</xsl:attribute> </xsl:if>HHH Building III </option> </select>
</xsl:template>
</xsl:stylesheet>
entry for "SSS Building I" is selected. (Or am I missing something? )
This transform creates the dropdown but doesn't do the select.
Can "if tests" work when there are spaces?
Thanks
<xml_data>
<building>SSS Building I</building>
</xml_data>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl
<xsl:template match="/">
<select name="building">
<option selected="selected">
<xsl:if test="not(/xml_data/building)">
<xsl:attribute name="selected">selected</xsl:attribute> </xsl:if>Select One </option> <option value="SSS Building I"> <xsl:if test="/xml_data/building='SSS Building I'"> <xsl:attribute name="selected">selected</xsl:attribute> </xsl:if>SSS Building I </option> <option value="SSS Building II"> <xsl:if test="/xml_data/building='SSS Building II'"> <xsl:attribute name="selected">selected</xsl:attribute> </xsl:if>SSS Building II </option> <option value="HHH Building III"> <xsl:if test="/xml_data/building='HHH Building III'"> <xsl:attribute name="selected">selected</xsl:attribute> </xsl:if>HHH Building III </option> </select>
</xsl:template>
</xsl:stylesheet>