返回与当前节点或所提供节点集中的第一个节点(按文档顺序)的 XSD 数据类型关联的命名空间 URI。
string ms:type-namespace-uri([node-set])
备注
对于简单 XSD 类型,type-namespace-uri
函数返回空字符串。 对于指定了 name
属性的复杂 XSD 类型,type-namespace-uri
函数返回完整的 URI,例如 "http://www.example.microsoft.com/my-xsd-types."
以下表达式示例返回数据类型的命名空间 URI 为“PurchaseOrderType”的节点。
//*[ms:type-namespace-uri()='uri:PurchaseOrderType')]
示例
以下示例使用 XSLT 模板规则,从 books.xml 中选择所有元素并输出元素数据类型和命名空间 URI(按 books.xsd 中的定义)。
XML 文件 (books.xml)
使用 books.xml。
XSD 文件 (books.xsd)
使用 books.xsd。
XSLT 文件 (books.xslt)
HTML 文件 (books.html)
HTML 文件包含处理加载 XML、XSLT 和 XSD 文件过程的 JScript。
输出
x:catalog is of "" in ""
book is of "" in ""
author is of "string" in "http://www.w3.org/2001/XMLSchema"
Gambardella, Matthew
title is of "string" in "http://www.w3.org/2001/XMLSchema"
XML Developer's Guide
genre is of "string" in "http://www.w3.org/2001/XMLSchema"
Computer
price is of "float" in "http://www.w3.org/2001/XMLSchema"
44.95
publish_date is of "date" in "http://www.w3.org/2001/XMLSchema"
2000-10-01
description is of "string" in "http://www.w3.org/2001/XMLSchema"
An in-depth look at creating applications with XML.
请注意,x:catalog
和 book
元素具有匿名数据类型。 因此,ms:type-local-name()
和 ms:type-namespace-uri()
函数都返回空字符串。