Funzione function-available() XSLT
Definizione e utilizzo
La funzione function-available() restituisce un valore booleano che indica se il processore XSLT supporta la funzione specificata.
Puoi testare le funzioni XSLT e le funzioni XPath ereditate.
Sintassi
funzione booleana function-available(string)
Parametro
Parametro | Descrizione |
---|---|
string | Obbligatorio. Specifica la funzione da testare. |
Esempio
<?xml version="1.0" encoding="ISO-8859-1"?> <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() è supportato.</p> </xsl:when> <xsl:otherwise> <p>sum() non è supportato.</p> </xsl:otherwise> </xsl:choose> <xsl:choose> <xsl:when test="function-available('current')"> <p>current() è supportato.</p> </xsl:when> <xsl:otherwise> <p>current() non è supportato.</p> </xsl:otherwise> </xsl:choose> </body> </html> </xsl:template> </xsl:stylesheet>