Subject: position accross multiple node sets?
From: "Jeff Barrett" <JBarrett@xxxxxxxxxxxxxxx>
Date: Tue, 13 Aug 2002 16:34:34 -0700
|
I'm trying to create a numbered list of items as plain text output from an XML file. In the interest of simplicity I've created a stripped down version of the problem below.
Let's say I've got XML that looks like this:
<items>
<book>XSLT Programmers Reference</book>
<book>Beginning XSLT</book>
<car>
<model>camry</model>
<year>2001</year>
</car>
<car>
<model>Explorer</model>
<year>2001</year>
</car>
<car>
<model>accord</model>
<year>1995</year>
</car>
<car>
<model>escort</model>
<year>1999</year>
</car>
</items>
I've created two templates that use position() to number the items. One that processes the <book/> nodes into:
0. XSLT Programmers Reference
1. Beginning XSLT
The other uses grouping on the car's <year/> node to output:
0. 2001
1. 1995
2. 1999
Making the sum-total of this template's output:
0. XSLT Programmers Reference
1. Beginning XSLT
0. 2001
1. 1995
2. 1999
What I actually need output is:
0. XSLT Programmers Reference
1. Beginning XSLT
2. 2001
3. 1995
4. 1999
I've got some ideas how to solve this, but I can't seem to get my head around them.
ideas?
thanks,
+jeff
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|