xsl:number always counts from 1. The format attribute does not affect this
behavior:
http://www.w3.org/TR/xslt#number
"The xsl:number element first constructs a list of positive integers
using the level, count and from attributes:"
Dave
Vinoth
Palaniappan To:
[email protected]
<[EMAIL PROTECTED] cc: (bcc: David N
Bertoni/Cambridge/IBM)
mot.com> Subject: RE: how to find
position?
07/31/2002 05:38
AM
I changed from <xsl:number value="position()"> to <xsl:number
level="1"/> inside <xsl:template match="nv_pair"> and it is counting all
"nv_pair" elements as one, two, three... But i want this to be counted from
zero. I changed the <xsl:number level="1"/> to <xsl:number format="0"/> and
the nv_pair elements are not being counted from zero as expected; Instead,
they are still being counted from one. Am i missing something in using
format attribute??
...
-----Original Message-----
From: Vinoth Palaniappan [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 31, 2002 1:29 PM
To: [email protected]
Subject: how to find position?
Hi All,
I've a DTD: <!ELEMENT filterable_body_data (nv_pair*)> and the
corresponding xml document is:
<filterable_body_data>
<nv_pair/>
<nv_pair/>
</filterable_body_data>
I've an XSL document for transferring this xml to a C++ header file. The
XSL
file snippet is:
<xsl:template match="filterable_body_data">
fill_filterable_body()
{
<xsl:for-each select="child::*">
<xsl:apply-templates
select="."></xsl:apply-templates>
</xsl:for-each>
}
When I use "position()" inside <xsl:template match="nv_pair">
....</xsl:template > I always get a value one which i think is
corresponding
to it's parent <filterable_body_data>. My doubt is how can i get the
position of nv_pair element inside the XSL snippet <xsl:template
match="nv_pair"> ....</xsl:template > .
thanks for reading through.