X Path Not Counting Second Element
Solution 1:
How about this:
<li><ahref="#"class ="Part 1"><xsl:value-ofselect="//foo:Entry[1]/foo:Heading"/></a></li><li><ahref="#"class ="Part 2"><xsl:value-ofselect="//foo:Entry[2]/foo:Heading"/></a></li>Alternatively, this should work too:
<li><ahref="#"class ="Part 1"><xsl:value-ofselect="(//foo:Heading)[1]"/></a></li><li><ahref="#"class ="Part 2"><xsl:value-ofselect="(//foo:Heading)[2]"/></a></li>From the almighty XPath spec:
//is short for/descendant-or-self::node()/. For example,//parais short for/descendant-or-self::node()/child::paraand so will select any para element in the document (even a para element that is a document element will be selected by//parasince the document element node is a child of the root node);div//parais short fordiv/descendant-or-self::node()/child::paraand so will select all para descendants of div children.NOTE: The location path
//para[1]does not mean the same as the location path/descendant::para[1]. The latter selects the first descendant para element; the former selects all descendant para elements that are the first para children of their parents.
Post a Comment for "X Path Not Counting Second Element"