ms:schema-info-available 函数

如果当前节点有 XSD 信息,则返回 true

        boolean ms:schema-info-available()

备注

以下表达式对所有具有 XSD 类型信息的节点返回 true

"//*[ms:schema-info-available()]"

示例

以下示例使用 XSLT 模板规则,从 books.xml 中选择所有元素并输出元素的数据类型和命名空间 URI(按 books.xsd 中的定义)。

XML 文件 (books.xml)

使用 books.xml

XSD 文件 (books.xsd)

使用 books.xsd

HTML 文件 (books.html)

该 HTML 文件与 ms:type-namespace-uri([node-set]) 函数主题中列出的文件相同。

XSLT 文件 (books.xslt)

输出

x:catalog is of "" in ""

book is of "" in ""

author is of "string" in "http://www.w3.org/2001/XMLSchema"

title is of "string" in "http://www.w3.org/2001/XMLSchema"

genre is of "string" in "http://www.w3.org/2001/XMLSchema"

price is of "float" in "http://www.w3.org/2001/XMLSchema"

publish_date is of "date" in "http://www.w3.org/2001/XMLSchema"

description is of "string" in "http://www.w3.org/2001/XMLSchema"

description is of "string" in "http://www.w3.org/2001/XMLSchema"

此处的输出与 ms:type-namespace-uri 主题中显示的相同,因为架构信息对每一个元素都可用。

另请参见

参考

XML 架构 (XSD) 参考
XML 数据类型引用

概念

使用针对 XSD 的 XPath 扩展函数支持