The function-available (string) function is used to test whether a function can be parsed by the XSLT processor. The string parameter is used to specify the name of the function to be tested.
Syntax: function-available (string)
Parameter: string, required
Return Value: Boolean
Example:
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 function unavailable </xsl: text> </xsl: otherwise> </xsl: choose> </xsl: template> </xsl: stylesheet>
Result:
XSLT