如何将值传递给XSLT中的用户定义函数
问题描述:
我想将我从XML获取的值employee_name
传递给XSL中的用户定义函数。请参阅下面的代码:如何将值传递给XSLT中的用户定义函数
<xsl:for-each select="employees/employee">
<xsl:value-of select="employee_name"/>
<xsl:value-of select="
my:compareCI(
'--how to pass employee_name Value--',
'--how to pass employee_name Value--'
)
" />
</xsl:for-each>
请任何帮助我,因为我是新来的XSL。
答
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns1="http://www.example.com">
<xsl:function name="ns1:functionName">
<xsl:param name="employee_name"/>
<xsl:value-of select="$employee_name"/>
</xsl:function>
<xsl:template match="/">
<xsl:value-of select="ns1:functionName('John Doe')"/>
</xsl:template>
</xsl:stylesheet>
我假设你的意思是XSL或XSLT。标题拼错 – 2009-12-11 12:40:54
请注意,这仅在XSLT2.0中可用,并且某些系统仍然只支持XSLT1.0 – 2009-12-11 12:41:27