Subject: Re: [xsl] How to select an attribute on the current node or its anchestor From: Michael Kay <mike@xxxxxxxxxxxx> Date: Fri, 15 Apr 2011 09:26:19 +0100 |
ancestor-or-self::*[@data][1]/@dataOr if you prefer, (ancestor-or-self::*/@data)[last()]
Michael Kay Saxonica
On Fri, Apr 15, 2011 at 2:06 AM, Philipp Kursawe<phil.kursawe@xxxxxxxxx> wrote:Hello,
given the following xml:
<node data="foo"> <text id="1" data="bar"/> <text id="2"/> </node>
I would like to know the XPath expression to select @data which results in "bar" for @id=1 and "foo" for @id=2.
The general idea is to search for the attribute in the anchestor if the current node does not contain the attribute all the way up to the root node.
Thanks for your help!
Phil
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to select an attribut, Brandon Ibach | Thread | Re: [xsl] How to select an attribut, Philipp Kursawe |
RE: [xsl] How to select an attribut, Trevor Nicholls | Date | Re: [xsl] mode, Andrew Welch |
Month |