The function-available function is used to test whether the function specified in the argument is supported by the XSLT processor. Currently, this is important when dealing with proprietary functions. In the future, this function will gain additional importance when you have to content with more than one version of the W3C XSLT standard.
If the function is supported, true is returned. If the function is not supported, false is returned.
The following XSLT and XPath functions should return true if a processor supports the W3C XSLT standard.
boolean | name |
ceiling | namespace-uri |
concat | normalize-space |
contains | not |
count | number |
current | position |
document | round |
element-available | starts-with |
false | string |
floor | string-length |
format-number | substring |
function-available | substring-after |
generate-id | substring-before |
id | sum |
key | system-property |
lang | translate |
last | true |
local-name | unparsed-entity-uri |
version="1.0">
<xsl:template match="/">
<html>
<body>
<xsl:choose>
<xsl:when test="function-available('aardvark')">
<xsl:text>The aardvark function is available</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>The aardvark function is not available</xsl:text>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The aardvark function is not available
Here we test to see if the aardvark function is available. This is the code for xslt_example_functionavailable.xsl.
We use the DevGuru Staff List XML file for our example
with the following header:
<?xml-stylesheet type="text/xsl" href="xslt_example_functionavailable.xsl"?>