当前位置: 首页 > 网络学院 > XML相关教程 > XSL/XSLT > XSLT 元素-available() 函数

XSL/XSLT
XSL 语言
XSLT 介绍
XSLT 浏览器
XSLT 转换
<xsl:template>
<xsl:value-of>
<xsl:for-each>
<xsl:sort>
<xsl:if>
<xsl:choose>
<xsl:apply-templates>
XSLT - 客户端
XSLT - 服务器端
XSLT - 编辑XML
XSLT 摘要
XSLT 元素参考
XSLT 函数
XSL 编辑器

XSL/XSLT 中的 XSLT 元素-available() 函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 216 ::
收藏到网摘: n/a

Definition and Usage
定义和用法

The element-available() function returns a Boolean value that indicates whether the element specified is supported by the XSLT processor.
element-available()函数的作用是:返回一个逻辑值,用于指定XSLT处理器是否允许支持指定的元素。

This function can only be used to test elements that can occur in a template body. These elements are:
这个函数仅能用于测试位于模版本身内的元素。这些元素包括:

  • xsl:apply-imports
  • xsl:apply-templates
  • xsl:attributes
  • xsl:call-template
  • xsl:choose
  • xsl:comment
  • xsl:copy
  • xsl:copy-of
  • xsl:element
  • xsl:fallback
  • xsl:for-each
  • xsl:if
  • xsl:message
  • xsl:number
  • xsl:processing instruction
  • xsl:text
  • xsl:value-of
  • xsl:variable

Syntax
语法

boolean element-available(string)

Parameters
参数

参数 描述
string Required. Specifies the element to test
必要参数。指定需要测试的元素对象

Example 1
案例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 文件以及结果

评论 (0) All

登陆 | 还没注册?