XSLT องค์ประกอบที่มีอยู่ () ฟังก์ชัน
ความหมายและการใช้งาน
องค์ประกอบที่มีอยู่ () ฟังก์ชันส่งกลับค่าบูลีนที่บ่งชี้ว่าหน่วยประมวลผล XSLT สนับสนุนองค์ประกอบที่ระบุ
ฟังก์ชั่นเท่านั้นที่สามารถใช้ในการทดสอบองค์ประกอบของร่างกายต้นแบบอยู่ที่ องค์ประกอบเหล่านี้คือ:
- XSL: ใช้-การนำเข้า
- XSL: ใช้แม่แบบ
- XSL: แอตทริบิวต์
- XSL: เรียกแม่แบบ
- XSL: เลือก
- XSL: แสดงความคิดเห็น
- XSL: คัดลอก
- XSL: สำเนาของ
- XSL: องค์ประกอบ
- XSL: ทางเลือก
- XSL: สำหรับแต่ละ
- XSL: ถ้า
- XSL: ข้อความ
- XSL: หมายเลข
- XSL: คำสั่งประมวลผล
- XSL: ข้อความ
- XSL: ค่าของ
- XSL: ตัวแปร
ไวยากรณ์
boolean element-available(string)
พารามิเตอร์
参数 | 描述 |
---|---|
string | 必需。规定要测试的元素。 |
ตัวอย่างที่ 1
<?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="element-available('xsl:comment')">
<p>xsl:comment is supported.</p>
</xsl:when>
<xsl:otherwise>
<p>xsl:comment is not supported.</p>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="element-available('xsl:delete')">
<p>xsl:delete is supported.</p>
</xsl:when>
<xsl:otherwise>
<p>xsl:delete is not supported.</p>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:choose>
<xsl:when test="element-available('xsl:comment')">
<p>xsl:comment is supported.</p>
</xsl:when>
<xsl:otherwise>
<p>xsl:comment is not supported.</p>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="element-available('xsl:delete')">
<p>xsl:delete is supported.</p>
</xsl:when>
<xsl:otherwise>
<p>xsl:delete is not supported.</p>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
วัตถุอ้างอิง XSLT ฟังก์ชั่นที่สมบูรณ์