XSLT function-available() 函式
❮ XSLT 函式參考定義和用法
function-available() 函式返回一個布林值,指示 XSLT 處理器是否支援指定的函式。
您可以測試 XSLT 函式和繼承的 XPath 函式。
語法
boolean function-available(string)
引數
引數 | 描述 |
---|---|
string | 必需。指定要測試的函式 |
示例 1
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:choose>
<xsl:when test="function-available('sum')">
<p>sum() 受支援。</p>
</xsl:when>
<xsl:otherwise>
<p>sum() 不受支援。</p>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="function-available('current')">
<p>current() 受支援。</p>
</xsl:when>
<xsl:otherwise>
<p>current() 不受支援。</p>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
❮ XSLT 函式參考