[xsl] position() returns what?

Subject: [xsl] position() returns what?
From: Morten Andersen <mortena@xxxxxxxxxx>
Date: Fri, 24 Oct 2003 10:37:45 +0200
ksI want to iterate through a list of elements and bewteen these elements put a link that indicates where in the xml-document we are.

For instance I want to transform:

  <part name="title-1" text="This is the text"></part>
  <part name="title-2" text="This is the text of the second part"></part>

Into something like:

<a href="editPart.action?number=0">Edit</a>
This is the text

My problem is how do I get the position / index of the part I'm transforming. I tryed with:

<xsl:template match="part">
    <xsl:value-of select="position()"/>

But this outputs equal numbers: 2,4,6,8,10,...
I did expect that it would output 0,1,2,3,4,5

I'm sure this comes down to the fact that I lack some background information, but I have a hard time finding that. What I'm looking for is a JavaDoc alike information preferably with good examples.


Morten Andersen Master of applied mathematics and computer science Amanuensis (in e-learning)

The Maersk Institute of Production technology at Southern Danish University www.mip.sdu.dk
Campusvej 55
DK-5230 Odense M
+45 6550-3654
+45 6171-1103
Jabber id: hat@xxxxxxxxx

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread