我有以下混合内容元素:
<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但它也不起作用。