xsl-list
[Top] [All Lists]

RE: XPatch: ancestor and count

2004-10-01 03:56:25
   <xsl:for-each select="child::menuitem">
    <tr><td><xsl:value-of select="count(.//ancestor::*)"/></td><td>
    <xsl:value-of select="@title"/></td></tr>
   </xsl:for-each>
 

In this context, './/' means 'descendant-or-self::*', right? 

Well spotted, I missed that.

.//ancestor::* means

./descendant-or-self::node()/ancestor::*

so you are counting how many distinct ancestors you and all your descendants
have. This is one for you, one for each of your ancestors, and one for each
of your descendants that has at least one child.

Michael Kay
http://www.saxonica.com/



<Prev in Thread] Current Thread [Next in Thread>