This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Finding attribute of a 'grand-parent'


Hello list,

I'm stuck again. As always I hope this is not a case of RTFM. Consider this
XML:

<po id="1">
  <someelement/>
  <po id="2">
    <someelement>
      <po id="3">
        <someelement/>
      </po>
    </someelement>
    <po id="4">
      <someelement/>
    </po>
  </po>
</po>

For the element <po id="3"> I'd like to get the id attribute from the
ancestor that is a po Element (in this case, '2'). 
What I got with 'ancestor::po' was '1', the attribute from the 'eldest'
ancestor. 'parent::po' returns nothing, because obviously it isn't the
parent i am seeking. More like the grand-parent, so to speak. 

In other words: I'm looking for the nearest ancestor relative who is not a
parent. And I don't want uncles, either... ;-)

Changing the xml-structure is not an option, unfortunately.

Any hints?

Thank you,
Christian

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]