Q: Numbering on parent position

Subject: Q: Numbering on parent position
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Mon, 22 Nov 1999 18:37:58 +1300
I'm trying to insert a number into a text string based on the
position of the current node's parent. For example, from

<root>
  <level1><level2 /><level2 /></level1>
  <level1><level2 /><level2 /><level2 /></level1>
</root>

getting output of the form

1. info
1. info
2. info
2. info
2. info

where the numbers reflect the position of the <level1> parents.

I've tried things like

<xsl:for-each select="level1/level2">
  <xsl:number value="../position()" />
  <xsl:text>info</xsl:text>
</xsl:for-each>

with various value arguments, with no luck.

I'm guessing this is fairly easy, and I haven't read the XPath
spec that closely - any ideas?

Thanks in advance


-- 
Warren Hedley
Department of Engineering Science
Auckland University
New Zealand


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


Current Thread