Re: [xsl] Simple lookup in XSLT2

Subject: Re: [xsl] Simple lookup in XSLT2
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 14 Nov 2006 10:54:15 GMT
> This works just fine with XSLT 1.0,

Odd as it's a syntax error.  name="$months" should be  name="months"
then the code should work in xslt2 as you have it, although it should
not work at all in xslt1 as a variable in xslt1 creeates a result tree
fragment not a node set so you can not query into it with $months/m.

In xslt2 you could also (more efficiently) do

<xslt:variable name="months" as="item()*" select=
 "('January','February','March','April','May','June','July','August','September','October','November','December')"/>

<xsl:value-of select="$months[number($month)]"/>

David

Current Thread