This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: <xsl:choose>
My code, so far, is as follows:
========================================================
<ATTRIBUTE>
<NAME>Default</NAME>
<VALUE>
<xsl:value-of select="@default"/>
<xsl:variable name="default">
<xsl:choose>
<xsl:when test="@default">
<xsl:value-of select="@default"/>
</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</VALUE>
</ATTRIBUTE>
That puts whatyou want into a variable that you then don't use, and
after the </VALUE> it goes out of scope so it is lost.
You could add a <xsl:value-of select="@default"/> but why define a
variable if you only use it once, you can use the result directly.
<ATTRIBUTE>
<NAME>Default</NAME>
<VALUE>
<xsl:choose>
<xsl:when test="@default">
<xsl:value-of select="@default"/>
</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</VALUE>
</ATTRIBUTE>
(I note that you are documenting the attribute name as Default
but using it as default which is dangerous as xml is case sensitive)
Of course, if you had a DTD you could declare the attribute default
there, then this would be
<ATTRIBUTE>
<NAME>Default</NAME>
<VALUE>
<xsl:value-of select="@default"/>
</VALUE>
</ATTRIBUTE>
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list