小编col*_*son的帖子

在 XSLT 中测试文本节点

我有以下混合内容元素:

<firstElement type="random">text1<secondElement>random_value</secondElement>text2</firstElement>
Run Code Online (Sandbox Code Playgroud)

我想for-each<firstElement>具有嵌套if条件的子节点上进行循环,例如:

<xsl:for-each select="child::*">
<xsl:if test="some test">
<xsl:copy>
</xsl:if>
</xsl:for-each>
Run Code Online (Sandbox Code Playgroud)

我怎样才能写一个test只选择 的文本节点<firstElement>

我已经尝试过text(),但它只适用于上下文节点的子文本节点,self::text()似乎不是一个合适的 Xpath。我还尝试使用 XSLT 2.0instance of进行测试,xs:string但它也不起作用。

xslt xpath xslt-2.0

2
推荐指数
1
解决办法
2871
查看次数

标签 统计

xpath ×1

xslt ×1

xslt-2.0 ×1