Finding position of the parent node in XSLT

Here’s a really nifty solution to the problem of finding the position of a node’s parent node from the comp.text.xml newsgroup. The idea is you can find the position of the parent node by you counting all its preceding siblings.

  1. <xsl :value-of
  2.   select="count(parent::bar/preceding-sibling::bar) + 1"/>
Posted on 03 Dec 04 by Helen Emerson (last updated on 03 Dec 04).
Filed under Web development