Hi Michael.
I don't know (I have so many fast answers already !!) which one is best, but
what is surprising me is how simple it seems once written...
Thanks a lot
Regards,
Fabien
-----Message d'origine-----
De : Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Envoyé : mardi 23 novembre 2010 16:25
À : xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Objet : Re: [xsl] selecting nodes based on sibling values
<xsl:variable name="gpsizes">
<xsl:for-each-group select="row" group-starting-with="row[level='40']">
<xsl:sequence select="count(current-group()) - 1"/>
</xsl:for-each-group>
</xsl:variable>
<xsl:value-of select="max($gpsizes)"/>
Michael Kay
Saxonica
On 23/11/2010 14:45, Fabien Tillier wrote:
Hi List.
Let's say I have an XML like below...
<data>
<row>
<level>40</level>
<keycode>1254.45.12</keycode>
</row>
<row>
<level>50</level>
<keycode>1254.45.12.7</keycode>
</row>
<row>
<level>50</level>
<keycode>1254.45.12.8</keycode>
</row>
<row>
<level>50</level>
<keycode>1254.45.12.9</keycode>
</row>
<row>
<level>40</level>
<keycode>99.25.6</keycode>
</row>
<row>
<level>50</level>
<keycode>99.25.6.45</keycode>
</row>
<row>
<level>50</level>
<keycode>99.25.6.46</keycode>
</row>
</data>
What could be the XPath expression to get the maximum number of nodes of
level=50 in data those keycode starts like the level=40 line ?
Here the answer would be 3 as the maximum number of level = 50 nodes for
a given level = 40 is 3
I have tried several things, but I am stuck....
(I am using XSLT 2.0 on Saxon)
Thanks for lending me some neurons...
Best regards,
Fabien
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or
e-mail:<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--