"if tests" and spaces

E

Emmett

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:eek: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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top