[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] xsl:if


Subject: Re: [xsl] xsl:if
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Mon, 17 Jan 2005 23:06:32 +0100

Tempore 22:44:52, die 01/17/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Bhaskar, Rajan <RBhaskar@xxxxxxx>:

If the attribute value from the input xml is optional. how do i write my xsl:if so that if the value is present get the value else default to "unknown"

full syntax: <xsl:choose> <xsl:when test="@value"> <xsl:value-of select="@value"/> </xsl:when> <xsl:otherwise> <xsl:text>unknown</xsl:text> </xsl:otherwise> </xsl:choose>

shortcut:
<xsl:value-of select="@value"/><xsl:if test="not(@value)">unknown</xsl:if>


regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) "Et ipsa scientia potestas est" - Francis Bacon , Meditationes sacrae


Current Thread
Keywords
xml