Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
xpath:从当前元素属性中的标识符中查找属性值_Xpath - Fatal编程技术网

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

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&

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

但是它不起作用,我不能使用current(),因为它在文本中不受支持

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

//section[section/p[@xml:id=//@getelement]]/subtitle
还要注意,
xml:id
属性不能以数字开头