当前位置: 首页 > 网络学院 > XML相关教程 > XSL/XSLT > XSLT 函数
XQuery 1.0, XPath 2.0, and XSLT 2.0 share the same functions library.
XQuery 1.0, XPath 2.0, 和XSLT 2.0共享一个函数库。
XSLT includes over 100 built-in functions. There are functions for string values, numeric values, date and time comparison, node and QName manipulation, sequence manipulation, Boolean values, and more.
XSLT包含了超过100个内置函数,包括字符串函数、数值函数、日期时间函数、节点、QName处理函数、序列处理函数、逻辑函数等等。
The URI of the XSLT function namespace is:http://www.w3.org/2005/02/xpath-functions
XSLT函数命名空间的URI是:http://www.w3.org/2005/02/xpath-functions
The default prefix for the function namespace is fn:.
函数命名空间的默认前缀是“fn”:
Tip: Functions are often called with the fn: prefix, such as fn:string(). However, since fn: is the default prefix of the namespace, the function names do not need to be prefixed when called.
提示: 函数的声明通常以“fn” 为前缀,如:“fn:string()”;然而,由于“fn:”是命名空间的默认前缀,因此,当声明函数时,函数名称不需要书写前缀名。
The reference of all the built-in XSLT 2.0 functions is located in our XPath tutorial.
请在我们的XPath教程中查找全部内置的XSLT2.0函数的参数
In addition, there are the following built-in XSLT functions:
作为补充,我们还例举了下面这些内置XSLT函数:
Name 名称 | Description 描述 |
current() | Returns the current node 返回当前节点 |
document() | Used to access the nodes in an external XML document 用于访问一个外部XML文档内的节点 |
element-available() | Tests whether the element specified is supported by the XSLT processor 测试指定的元素是否被XSLT处理器支持 |
format-number() | Converts a number into a string 将某个数字转化为对应的字符串 |
function-available() | Tests whether the function specified is supported by the XSLT processor 测试指定的函数是否被XSLT处理器支持 |
generate-id() | Returns a string value that uniquely identifies a specified node 返回一个独立定义指定节点的字符串值 |
key() | Returns a node-set using the index specified by an <xsl:key> element 使用由<XSL:key>元素指定的索引来返回一个节点集 |
system-property() | Returns the value of the system properties 返回系统属性值 |
unparsed-entity-uri() | Returns the URI of an unparsed entity 返回一个未被解析的实体元素的URI |