xslt2.0的函数使用,不能返回正常的值
大家好,经过我在网上的查询,我想自定义一个xslt函数。可不知道为啥,总是不能用。函数的定义是这样的。
<xsl:function name="str:getColumnType" as="xs:string">
<xsl:param name="columnType" as="xs:string"/>
<xsl:choose>
<xsl:when test="contains($columnType, 'char')">
<xsl:text>string</xsl:text>
</xsl:when>
<xsl:when test="contains($columnType, 'int')">
<xsl:text>int</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>none</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
当我手动调用的时候是正常的
如:<xsl:value-of select="str:getColumnType('nvarchar(60)')"/>
这个时候返回string,这是正常的。
当时当我通过查询进行调用,就不行了。
如:<xsl:value-of select="str:getColumnType(string(./*[local-name()='DataType']))" />
则总是返回int。
这是为什么?