This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
position of an element
- To: "Xsl-List (E-Mail)" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] position of an element
- From: Sebastian Schirmer <schirmer at sitewaerts dot de>
- Date: Fri, 25 May 2001 12:02:32 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hello,
I think this is an easy to solve problem but I dont see the lights ...
At the moment, my XML looks like this:
--- snip ---
<elements>
<content number="1">
<content number="2">
<content number="3">
<content number="4">
<content number="5">
</elements>
--- snip ---
In my XSL I have then access to the first / second / third / ... occuring
content element by comparing the number attribute values and I know exactly
that it is the first / second / third / ... content element in the document.
This is important for me to know.
How to manage it without assigning a number attribute to the content
elements in the XML? Maybe something like this:
Pseudo-code:
<template match="content">
<xsl:value-of select="position-of-this-element-in-the-document()" />
</template>
Sebastian Schirmer
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list