更新时间:2023-11-25 23:44:22
Try count(.//testdata) >0
.
但是,如果您的上下文节点是 textdata
并且您想测试它是否有 somenode
子节点,我会写:
However if your context node is textdata
and you want to test whether it has somenode
child or not i would write:
<xsl:if test="somenode">
...
</xsl:if>
但我认为这不是你真正想要的.我认为您应该阅读编写 XSLT 样式表的不同技术(推/拉处理等).应用这些时,通常不需要这样的表达式,样式表变得更简单.
But I think that's not what you really want. I think you should read on different techniques of writing XSLT stylesheets (push/pull processing, etc.). When applying these, then such expressions are not usually necessary and stylesheets become simplier.