xml - xslt 1.0 节点集错误,转换无效
问题描述
我在 1.0 版本中遇到了 xslt 的问题。我的节点看起来像这样
...
<Garage>
<car>
<color>red</color>
<color>yellow</color>
<wheel>left</wheel>
<car/>
</Garage>
...
然后我将子节点保存到变量中
<xsl:variable name="entries">
<xsl:if test="$element/Garage/car">
<xsl:value-of select="$element/Garage/car"/>
</xsl:if>
</xsl:variable>
当我在模板中使用这个变量时
<xsl:template name="entriesToString">
<xsl:param name="table"/>
<xsl:for-each select="$table/color">
<xsl:if test="position() = last()">
<xsl:value-of select="concat(current(),'/')"/>
</xsl:if>
<xsl:value-of select="concat(current(),',')"/>
</xsl:for-each>
</xsl:template>
我收到这样的错误
ERROR: 'Invalid conversion from 'com.sun.org.apache.xalan.internal.xsltc.dom.SimpleResultTreeImpl' to 'node-set'.'
xslt 中的节点迭代有什么问题吗?
解决方案
推荐阅读
- laravel - Laravel:phpunit 在运行测试之前没有迁移
- sympy - Sympy 被某些方程式卡住了
- javascript - 本地存储的 Firefox WebExtension“浏览器未定义”
- javascript - 使用 Axios 在 Node.js 中克服 Pending Promise 并完成构建 JSON
- php - Woocommerce - 如何删除价格并将类别添加到追加销售和相关产品中?
- angular - 带有 Toast 的离子表单验证器
- python - Perl 解释器中的 Python 代码执行
- xcode10 - 错误修复 Xcode 10,条件的 Swift 4 初始化程序必须有可选
- android - 我怎样才能同步订阅一个可观察的,这样我就不会错过该可观察的排放?
- javascript - Javascript firebase.database().ref.on(...) 返回 null