Tha*_*i J 6 xpath xforms orbeon
假设我的view.xml中有以下表单数据实例:
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:exforms="http://www.exforms.org/exf/1-0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xhtml:head>
<xforms:instance id="instanceData">
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<fruits>
<fruit>
<fruit-name>Mango</fruit-name>
</fruit>
<fruit>
<fruit-name>Apple</fruit-name>
</fruit>
<fruit>
<fruit-name>Banana</fruit-name>
</fruit>
</fruits>
</form>
</xforms:instance>
</xhtml:head>
Run Code Online (Sandbox Code Playgroud)
我想从上面的实例中选择所有水果名称.我尝试了以下方法,但它总是选择第一个水果.
instance('instanceData')/fruits/fruit[*]/fruit-name
instance('instanceData')/fruits/fruit/fruit-name
instance('instanceData')/fruits/fruit[position()>0]/fruit-name
Run Code Online (Sandbox Code Playgroud)
请提供一种在XPATH中克服此问题的方法
Fur*_*edi 10
试试这个
"//fruit-name"
Run Code Online (Sandbox Code Playgroud)
它将在文档层次结构中的任何位置找到所有水果名称.