Wednesday, 15 February 2012

xpath: find attribute value from identifier in current element attribute -



xpath: find attribute value from identifier in current element attribute -

i have xml construction looks this:

<document> <body> <section> <title>something</title> <subtitle>something again</subtitle> <section> <p xml:id="1234">some text</p> </section> </section> <section> <title>something2</title> <subtitle>something again2</subtitle> <section> <p xml:id="12345678">some text2</p> <p getelement="1234"></p> </section> </section> </body> </document>

i want search attribut value defined in "getelement". got code friendly soule here:

class="lang-none prettyprint-override">//section[section/p[@xml:id=@getelement]]/subtitle

but doesnt work , cant utilize current() since not supported in arbortext.

you comparing attributes of same element, not. have find getelement:

class="lang-none prettyprint-override">//section[section/p[@xml:id=//@getelement]]/subtitle

also note xml:id attributes cannot start digits.

xpath

No comments:

Post a Comment