This XPath should do the trick: ancestor::*[name()='page'][@id]/@id
-John K Miroslav Nachev wrote: > Hi, > > I have the following XML Tree: > <doc> > <pages> > <page id="pg_1"> > </page> > <page id="pg_2"> > <chapter> > <article> > <article> > <article> > </article> > </article> > <article> > <article> > <article> > </article> > </article> > </article> > </article> > </chapter> > </page> > <page id="pg_3"> > </page> > </pages> > </doc> > > I have some XSL transformation file and when I am in the position > "<article>" I would like to see on which page ID I am. Can some body > help me? How to get the current parent with name "page"? In my case I > don't know on which level of article element I am !!! > > > Best Regards, > Miroslav Nachev > > >
