This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Number of node in list from stylesheet
- To: "Juergen Hermann" <jhe at webde-ag dot de>
- Subject: Re: Number of node in list from stylesheet
- From: Jeni Tennison <Jeni dot Tennison at epistemics dot co dot uk>
- Date: Tue, 23 May 2000 14:27:03 +0100
- Cc: xsl-list at mulberrytech dot com
- Reply-To: xsl-list at mulberrytech dot com
Jürgen,
>>Within the stylesheet, I needed to convert a month's name into a month
>>number, so January = 01, May = 05 and so on. So I defined the months in
>>order within the stylesheet itself:
>
>Here's a working solution, define this within <xsl:stylesheet> (i.e. on the
>top level):
>
> <xsl:variable name="months">
> <month name="January">01</month>
[snip]
>
>Later, in a template (assuming the month name is in $month):
>
> <xsl:value-of select="$months[@name=$month]"/>
I hadn't thought about putting the months in a variable like that. I don't
understand how you got this to work because listing the months within a
variable as you've done turns them into a result tree fragment, which can't
then be referenced into by a pattern (proof of the pudding - when I tried
it in SAXON, it objected).
You're also numbering them by hand, which is what I wanted to get away from.
However, I'm pretty sure I could use your method and generate a number
using position() or xsl:number, if I was happy using the node-set
extensions, so thank you.
Cheers,
Jeni
Dr Jeni Tennison
Epistemics Ltd, Strelley Hall, Nottingham, NG8 6PE
Telephone 0115 9061301 • Fax 0115 9061304 • Email
jeni.tennison@epistemics.co.uk
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list