[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: <xsl:choose>

Subject: Re: <xsl:choose>
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 15 Nov 2000 15:36:11 GMT
xsl choose default

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.