มีฟังก์ชัน XSLT ()ฟังก์ชัน
❮ การอ้างอิงฟังก์ชัน XSLTความหมายและการใช้งาน
ฟังก์ชัน function-available() ส่งคืนค่าบูลีนที่ระบุว่าฟังก์ชันที่ระบุได้รับการสนับสนุนโดยโปรเซสเซอร์ XSLT หรือไม่
คุณสามารถทดสอบฟังก์ชัน XSLT และฟังก์ชัน XPath ที่สืบทอดมา
ไวยากรณ์
boolean function-available(string)
พารามิเตอร์
Parameter | Description |
---|---|
string | Required. Specifies the function to test |
ตัวอย่าง 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() is supported.</p>
</xsl:when>
<xsl:otherwise>
<p>sum() is not supported.</p>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="function-available('current')">
<p>current() is supported.</p>
</xsl:when>
<xsl:otherwise>
<p>current() is not supported.</p>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
❮ การอ้างอิงฟังก์ชัน XSLT