我正在尝试使用pentaho水壶从xml中提取一些数据。
我想提取每个表中的所有 tr 节点,以便我可以用分隔符"/"连接它们
<entry>
<table>
<tr> item1 </tr>
<tr> item2 </tr>
<tr> item3 </tr>
<tr> item4 </tr>
</table>
</entry>
<entry>
<table>
<tr> item1 </tr>
<tr> item2 </tr>
<tr> item3 </tr>
<tr> item4 </tr>
</table>
</entry>
结果会像
fieldname
item1/item2/item3/item4
item5/item6/item7/item8
有没有办法在从 XML 获取数据中使用 XPath 执行此操作
现在我使用这个循环Xpath从Xpath获取数据
/*[name()='entry'][1]/*[name()='table']/*[name()='tr']
使用 JavaScript 连接结果,将它们放在 Excel 输出中,然后重复这些步骤直到条目[20]。 但稍后我将不得不将页面查询从 1 增加到 20,因此此方法无法扩展......
如果有人能帮助我,我将不胜感激!
提前感谢!
您使用的是哪个版本的 xPath 2.0 这将起作用
string-join(//table[1]/tr/text(),"/")
string-join(//table[2]/tr/text(),"/")