This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xsl:choose / xsl:when problems
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] xsl:choose / xsl:when problems
- From: Tony Graham - Sun Ireland - Staff Engineer <Tony dot Graham at ireland dot sun dot com>
- Date: Wed, 21 Feb 2001 18:28:18 +0000 (GMT)
- References: <200102211629.LAA25963@biglist.com><000f01c09c30$8ccc0cc0$0100a8c0@cr273144a>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Wayne Davis wrote at 21 Feb 2001 -0800:
> Hi...
> I'm trying to come up with a solution (this hack is the best I seem capable
> of at the moment) to converting
> a date in the following format "YYYY-MM-DDTHH:NN:SS" to MMM dd, yyyy".
>
> <TD>
> <xsl:choose>
> <xsl:when test="substring(@DateReceived,6,2) = '01'"/>January</xsl:when>
...
> I'm getting this error message:
> ***End tag 'xsl:when' does not match the start tag 'xsl:choose'. ***
> Can someone see where I'm off track here? I've tried bracketing the test
> statement in a variety of ways and always get the same result.
Your xsl:when start-tags are written as empty tags because they end
with "/>", so the first "</xsl:when>" is being matched with the
xsl:choose start-tag, and naturally they don't match. Try:
<xsl:when test="substring(@DateReceived,6,2) = '01'">January</xsl:when>
etc.
Also, you could declare a variable to hold the value of the substring
and just test against the variable value in each of your test
attributes so that your xsl:choose is easier to read (and probably
quicker as well).
Regards,
Tony Graham Email: tony.graham@ireland.sun.com
Staff Engineer Phone: +353 1 819 9708
Sun Microsystems Ireland Ltd x19708
Hamilton House, East Point Business Park, Dublin 3, Ireland
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list