[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi Spencer,
I just had a peek in Michael Key's excellent reference (XSLT 2.0 Programmer's Reference 3rd Ed., Wrox Press). It says, literally (quote): "New options have been added in XSLT 2.0 for formatting numbers as words (so you can output +Chapter Three;) and as ordinal numbers (so you can output +Fit the First; or +3rd Act;)". This implies using XSLT 2.0 for doing so (but you didn't specify if you use 2.0 or 1.0).
and produces output as such: 1st, 2nd, 3rd, 4th, 5th etc.
I am not sure how well the implementation is of this part, I haven't tried it myself.
Hope this helps,
Spencer Tickner wrote:
Re: [xsl] Numbering 1st 2nd 3rd ...
Subject: Re: [xsl] Numbering 1st 2nd 3rd ... From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Tue, 12 Sep 2006 22:48:04 +0200 |
Hi Spencer,
I just had a peek in Michael Key's excellent reference (XSLT 2.0 Programmer's Reference 3rd Ed., Wrox Press). It says, literally (quote): "New options have been added in XSLT 2.0 for formatting numbers as words (so you can output +Chapter Three;) and as ordinal numbers (so you can output +Fit the First; or +3rd Act;)". This implies using XSLT 2.0 for doing so (but you didn't specify if you use 2.0 or 1.0).
The right syntax would become something like: <xsl:number format="1" ordinal="yes" />
and produces output as such: 1st, 2nd, 3rd, 4th, 5th etc.
I am not sure how well the implementation is of this part, I haven't tried it myself.
Hope this helps,
Cheers, Abel Braaksma http://abelleba.metacarpus.com
Spencer Tickner wrote:
Hi List,
Thanks in advance for the help. I'm wondering if there's an elegant way to format position() like: 1st 2nd 3rd and so on. I've looked through google for a format that works with xsl:number, but haven't been able to find anything. I know I could always do a long <xsl:choose> statement, but it feels wrong. Anyway here's some samples
XML
<root> <num>foo</num> <num>bar</num> </root>
Output
<root> <num>1st</num> <num>2nd</num> </root>
Cheers,
Spencer
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Numbering 1st 2nd 3rd ..., Michael Kay | Thread | Re: [xsl] Numbering 1st 2nd 3rd ..., Steve |
Re: [xsl] Numbering 1st 2nd 3rd ..., Spencer Tickner | Date | Re: [xsl] Numbering 1st 2nd 3rd .., pnorton |
Month |
Keywords