XSLT函数——function-available()
function-available(string)函数用于测试某个函数是否可以被XSLT处理器解析。参数string用于指定要测试的函数名。
语法:function-available(string)
参数:string字符串,必需
返回:布尔型
示例:
xml:
<?xml version="1.0" encoding="UTF-8"?> <books> <book id="1"> <name>XSLT</name> </book> </books>
xslt:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="1.0" encoding="gb2312" indent="yes"/> <xsl:template match="/books"> <xsl:choose> <xsl:when test="function-available('current')"> <xsl:copy-of select="."/> </xsl:when> <xsl:otherwise> <xsl:text>current函数不可用</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
结果:
XSLT

浙公网安备 33010602011771号