gpt4 book ai didi

xml - 如何查明属性是否存在于 XSL 中

转载 作者:数据小太阳 更新时间:2023-10-29 01:38:25 26 4
gpt4 key购买 nike

如何在 XSL 中查明属性是否存在。

最佳答案

只需使用:

<xsl:template match="someElement/@someAttrName">
<!-- Whatever specific work when someElement has @someAttrName -->
</xsl:template>

<xsl:template match="someElement[not(@someAttrName)]">
<!-- Whatever specific work when someElement has no @someAttrName -->
</xsl:template>

请注意:在编写良好的 XSLT 代码中,条件指令的数量(例如 <xsl:choose><xsl:when><xsl:otherwise><xsl:if> ……等)接近于零。在此解决方案中,它 0。

关于xml - 如何查明属性是否存在于 XSL 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4918837/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com