"if tests" and spaces

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

Dimitre Novatchev

Usenet Archive
Joined
Nov 7, 2000
Messages
737
Reaction score
0
"Emmett" wrote:

The transform below should create a dropdown where the
entry for "SSS Building I" is selected. (Or am I missing something? )

I cannot reproduce your problem -- the transformation when performed by 10 different XSLT processors produces the correct dropdown list with the correct selection.

What XSLT processor are you using?

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
 

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
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top