|
Subject: [xsl] determining position based on predicate From: Terry Ofner <tdofner@xxxxxxxxx> Date: Fri, 15 Oct 2010 13:05:14 -0400 |
I am attempting to find the position of an element based on a predicate. Is
this possible.
Here is a snippet of incoming xml:
<chapter>
<tocItem startNum="38" endNum="39">
<sublesson>
<subtitle>Topic A</subtitle>
<subpages> pp. 4041</subpages>
</sublesson>
</tocItem>
<!--much more like this-->
<tocItem startNum="40" endNum="41">
<lesson>
<lessontitle>Lesson A</lessontitle>
<subpages> pp. 4041</subpages>
</sublesson>
</tocItem>
</chapter>
The following count statement does not seem to work. Is there a way to find a
position based on a predicate?
<xsl:template match="chapter">
<xsl:for-each select="tocItem">
<xsl:choose>
<xsl:when position()=count(.[lesson/lessontitle='Lesson A'])-1">
<!--do some stuff and close when, choose etc.-->
I can use position()=last()-1 but the desired position is not always second to
the last.
Terry
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Create dynamic table with 3 c, Shashank Jain | Thread | Re: [xsl] determining position base, David Carlisle |
| [xsl] Create dynamic table with 3 c, Shashank Jain | Date | Re: [xsl] determining position base, David Carlisle |
| Month |