xsl-list
[Top] [All Lists]

[xsl] Finding the path to a node

2007-05-11 06:05:04
Hello,

First I would like to thank this list. So far all my
problems with XSLT could be solved with your help. Thank you!

I have a new one: I have to find the "root"-node of a node
(not the document root, but a certain root).

Let's say I want to find the root-page-node for page-node with id 4.
Result should be page-node with id 1. A list of nodes 1,2,3 is
acceptable, too.

<pages>
<page id="1">
 <page id="2">
  <page id="3">
   <page id="4">
   </page>
  </page>
 </page>
</page>
<page id="5" />
<page id="6" />
</pages>

I tried with, but this is a loop and wrong...

<xsl:apply-templates select="//page[(_at_)id='4']/ancestor:node()" />

Regards, Kai

--~------------------------------------------------------------------
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>
--~--

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