XSLT2.0 |撒克逊人 |将分隔符作为参数传递
XSLT2.0 | Saxon HE | passing separator as param
具有如下功能:
<xsl:function name="fn:get-hierachy">
<xsl:param name="hierarchy" required="yes" as="node()"/>
<xsl:param name="separator0" required="no" as="xs:string"/>
<xsl:value-of select="$hierarchy/*" separator="$separator0"/>
</xsl:function>
我得到 'separator0' 作为输出的定界符,例如
<xsl:value-of select="fn:get-hierarchy($place, ' > ')"/>
结果:
Earth$separator0Africa$separator0Egypt
我将我的自定义定界符作为第二个函数参数传递 = ' > '
但它被忽略了,取而代之的是变量名。
期望的输出:
Earth > Africa > Egypt
Is it possible to pass separator argument value as a parameter?
对于 separator
属性,您需要使用属性值模板 <xsl:value-of select="$hierarchy/*" separator="{$separator0}"/>
。
具有如下功能:
<xsl:function name="fn:get-hierachy">
<xsl:param name="hierarchy" required="yes" as="node()"/>
<xsl:param name="separator0" required="no" as="xs:string"/>
<xsl:value-of select="$hierarchy/*" separator="$separator0"/>
</xsl:function>
我得到 'separator0' 作为输出的定界符,例如
<xsl:value-of select="fn:get-hierarchy($place, ' > ')"/>
结果:
Earth$separator0Africa$separator0Egypt
我将我的自定义定界符作为第二个函数参数传递 = ' > '
但它被忽略了,取而代之的是变量名。
期望的输出:
Earth > Africa > Egypt
Is it possible to pass separator argument value as a parameter?
对于 separator
属性,您需要使用属性值模板 <xsl:value-of select="$hierarchy/*" separator="{$separator0}"/>
。