Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Finding deepest node

From: marcus <m-lists@---------->
To:
Date: 12/2/2005 9:00:00 PM
Jon Gorman wrote:

> Well......what do you mean by farthest away?  I'm sure it's probably 
possible.




When I say farthest away I mean the node that has the most nodes between 
itself and the context node in a straight line (not counting siblings).



.//node[@a = 'avalue' and max(count(ancestor::*))]/@id



I know that isn't a valid expression but I hope you know what I mean



Example:



<nodes>
 <node a="1" id="1"/>
 <node a="2" id="2">
  <node a="1" id="3">
   <node a="1" id="3.1"/>
  </node>
  <node a="1" id="4"/>
 </node>
 <node a="2" id="5">
  <node a="1" id="6">
   <node a="1" id="7"/>
  </node>
 </node>
</nodes>

Say that a node must have @a=1 to be selectable.



In this example the nodes with @id=3.1 and @id=7 are furthest away from 
<nodes> and have a distance of 3. @id=3, @id=4, @id=6 have a distance of 
2 and so on.



/Marcus


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent