[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|