XSLT function-available()-funktionen

Definition och användning

function-available()-funktionen returnerar ett booleskt värde som indikerar om XSLT-processorn stöder den specifika funktionen.

Du kan testa XSLT-funktioner och arvade XPath-funktioner.

Syntaks

boolean function-available(string)

Parameter

Parameter Beskrivning
string Nödvändigt. Specificerar den funktion som ska testas.

Exempel

<?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() stöds.</p>
</xsl:when>
</xsl:otherwise>
<p>sum() stöds inte.</p>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="function-available('current')">
<p>current() är stödd.</p>
</xsl:when>
</xsl:otherwise>
<p>current() stöds inte.</p>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Visa XSL-fil,Visa resultat.