xpath:从当前元素属性中的标识符中查找属性值

时间:2013-02-15 13:16:06

标签: xpath

我的XML结构如下所示:

<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>

我想搜索“getelement”中定义的attribut值。我在这里得到了一个友善的代码:

//section[section/p[@xml:id=@getelement]]/subtitle

但它不起作用,我不能使用current(),因为Arbortext不支持它。

1 个答案:

答案 0 :(得分:0)

您正在比较同一元素的属性,但它们不是。你必须找到getelement

//section[section/p[@xml:id=//@getelement]]/subtitle

另请注意,xml:id属性不能以数字开头。

相关问题