xpath:从当前元素属性中的标识符中查找属性值
我的XML结构如下所示:xpath:从当前元素属性中的标识符中查找属性值,xpath,Xpath,我的XML结构如下所示: <document> <body> <section> <title>something</title> <subtitle>Something again</subtitle> <section> <p xml:id="1234">Some text</p> </section> </section> <section&
<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>
但是它不起作用,我不能使用current(),因为它在文本中不受支持 您正在比较同一元素的属性,但它们不是。您必须找到
getelement
:
//section[section/p[@xml:id=//@getelement]]/subtitle
还要注意,xml:id
属性不能以数字开头