我正在尝试选择与某些自闭标记元素相邻的文本。这是到目前为止我得到的。
来源:
<markers>
<self_closing_marker id="1"/> Some content, possible <othernodes>nodes with text</othernodes>
<self_closing_marker id="2-3"/> Some more content
</markers>
XSLT:
<xsl:template name="markers" match="self_closing_marker">
<xsl:value-of select="following-sibling::text()" />
</xsl:template>
问题在于,以下同级将选择所有内容,直到当前包装器的末尾。我发现有一些解决方案使用当前同级变量作为变量,并基于此使用先前同级变量,但是每当实现它们时,我都会得到空标签。
最终目标是获得与]类似的东西>
<markers>
<marker id="1">Some content, possible nodes with text</marker>
<marker id="2-3">Some more content</marker>
</markers>
我正在尝试选择与某些自闭标记元素相邻的文本。这是到目前为止我得到的。来源:
一种方法是用end
轴上的第一个self_closing_marker
元素分配变量following-sibling::
。
您可以从相反的方向看:
如果您准备使用Saxon扩展功能(需要PE或更高版本,则可以使用: