W3C home > Mailing lists > Public > xsl-editors@w3.org > January to March 2001

if expression

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Thu, 1 Mar 2001 16:03:58 -0500 (EST)
Message-ID: <B2C1451A181BD411B88A00E018C1C19C08AAD8@THOR>
To: "'xsl-editors@w3.org'" <xsl-editors@w3.org>
It would be useful to have an if() expression in XSLT 1.1 or 2.0 as a complement to the existing <xsl:choose> construct.  So for example, if you had a transform that produced a <TD> element that
contained either "None" or the count of child element, you could do:

<TD><xsl:value-of select="if(*,count(*),'None')"/></TD>

instead of:

<xsl:choose>
	<xsl:when test="*"><TD><xsl:value-of select="count(*)"/><TD></xsl:when>
	<xsl:otherwise><TD>None</TD></xsl:otherwise>
</xsl:choose>
Received on Saturday, 3 March 2001 15:41:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:52 GMT