|
Subject: Re: <xsl:choose> From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 15 Nov 2000 15:36:11 GMT |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| <xsl:choose>, Reich, Eric | Thread | Transforming XML to XML, Zeljko Rajic |
| <xsl:choose>, Reich, Eric | Date | Transforming XML to XML, Zeljko Rajic |
| Month |