这里是我的XML的摘录:的XPath:选择所有的兄弟姐妹之后,直到另一个兄弟
<node/>
<node/>
<node id="1">content</node>
<node/>
<node/>
<node/>
<node id="2">content</node>
<node/>
<node/>
我定位在node[@id='1']
。我需要一个Xpath来匹配所有的<node/>
元素,直到下一个非空节点(这里是node[@id='2']
)。
编辑: 的@id属性只更清楚地解释我的问题,但不是在我原来的XML。我需要一个不使用@id属性的解决方案。
我做不希望node[@id='2']
后为空的兄弟姐妹匹配,所以我不能用一个天真following-sibling::node[text()='']
。
我该如何做到这一点?
参见:http://stackoverflow.com/questions/2165566/xslt-select-following-sibling -until-reaching-a-specified-tag – WBT 2012-07-09 21:56:06
这可能是有用的:[http://stackoverflow.com/questions/2063619/how-to-reformat-xml-with-group-adjacent-xslt](http:/ /stackoverflow.com/questions/2063619/how-to-reformat-xml-with-group-adjacent-xslt) – igor 2010-01-29 13:25:18