[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Number formatting with <xsl:number />

Subject: Number formatting with <xsl:number />
From: Ragnar Schierholz <raschi@xxxxxxxxxx>
Date: Thu, 29 Jun 2000 16:57:30 -0500
number format in xslt
Hi!
I'm using Xeena 1.1 to create HTML files from XML files.
I'm dealing with a list of <option> elements which should be displayed in 
a table, each row one element. To make it a little more readable, I would 
have to have an index (formatted as a), b), c) ...) for each row. To 
obtain the current index I count the preceding-sibling::option axis. This 
all works pretty well, just when I want to convert the numerical index 
into the corresponding letter, the XSL engine can't parse the stylesheet 
anymore.
The code I'm using looks like this:

<xsl:template match="option" mode="HTML">
<xsl:variable name="rowIndex"><xsl:value-of 
select="count(preceding-sibling::option)"/></xs:variable>
        <TR>
                <TD>
                        <xsl:number value="number($rowIndex+1)" 
format="a"/>
                </TD>
                <TD>
                        further row content
                </TD>
        </TR>
</xsl:template>

The error message is pretty meaningless:
XSL Error: SAX Exception, Location file: option.xsl, line 15, offset 62 
(which is actually the closing angle bracket of the <xsl:number/> tag)

If I replace the 
        <xsl:number value="number($rowIndex+1)" format="a"/>
tag with 
        <xsl:value-of select="number($rowIndex+1)"/>
I get the index I want, just as number and not as a letter. Since I 
already use numbers for a different level of nested list, this would cause 
confusion and I don't want to get into hierarchical numbering, because 
this would make the column pretty wide (besides I would also want to do 
that with <xsl:number> and not manually).
What do I do wrong? Or doesn't the XSLT engine in built-in Xeena support 
<xsl:number>? I thought that was a mandatory element...

Any ideas?

Thanx in advance,
                Ragnar

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.