This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Number of node in list from stylesheet
- To: xsl-list at mulberrytech dot com
- Subject: Re: Number of node in list from stylesheet
- From: Sebastian Rahtz <sebastian dot rahtz at computing-services dot oxford dot ac dot uk>
- Date: Tue, 23 May 2000 12:41:47 +0100 (BST)
- References: <3.0.6.32.20000523122441.011f2100@NTServer>
- Reply-To: xsl-list at mulberrytech dot com
Jeni Tennison writes:
> number, so January = 01, May = 05 and so on. So I defined the months in
> order within the stylesheet itself:
>
> <foo:months>
> <foo:month name="January" abbr="Jan" />
> <foo:month name="February" abbr="Feb" />
wouldn't it be easier to just say
<foo:month name="February" abbr="Feb" number="02"/>
and have done with it?
> <xsl:variable name="monthNumber">
> <xsl:for-each select="document('')//foo:month[@name = $monthName]">
> <xsl:value-of select="format-number(position(), '00')" />
> </xsl:for-each>
> </xsl:variable>
>
> always sets $monthNumber = 1.
naturally. you select a single node, so it is always #1 in resulting
list
Sebastian
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list