2013-02-15 158 views
0

我有一个XML结构是这样的:XPath的:找到标识属性值在当前元素属性

<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:[email protected]]]/subtitle 

,但它不工作,我不能使用当前的(),因为它是不支持的Arbortext。

回答

0

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

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

还要注意的是xml:id属性不能用数字开始。