Compartilhar via


Microsoft XPath Extension Functions

MSXML provides a number of extension functions to offer additional features beyond those specified in the XPath Version 1.0 specifcation. Some of these extension functions enable manipulations of nodes based on their XSD data types. Others provide some popular utilities, such as lexicographical comparison of strings, formatting times and dates, converting date/time to Coordinated Universal Time units, etc.

The names of extended functions must be of qualified name consisting of a namespace URI (or its proxy), a colon, and a local part. Microsoft XPath extension functions typically sport a ms prefix that has been associated with the namespace URI ("urn:schemas-microsoft-com:xslt") for the Microsoft extension functions.

XPath Extension Functions for XSD Support

Function Description

ms:type-is

Compares the current node's data type against the specified node type.

ms:type-local-name ([node-set])

Returns the nonqualified name of the XSD type of the current node or the first node (in document order) in the provided node-set.

ms:type-namespace-uri ([node-set])

Returns the namespace URI associated with the XSD type of a current node or the first node (in document order) in the provided node-set.

ms:schema-info-available

Returns true if XSD information is available for a current node.

XPath Extension Functions of Miscellaneous Utilities


Function Description

ms:string-compare

Performs lexicographical string comparison.

ms:utc

Converts the prefixed date/time related values into Coordinated Universal Time and into a fixed (normalized) representation that can be sorted and compared lexicographically.

ms:namespace-uri

Resolves the prefix part of a qualified name into a namespace URI.

ms:local-name

Returns the local name part of a qualified name by stripping out the namespace prefix.

ms:number

Takes a string argument in XSD format and converts it into an XPath number.

ms:format-date

Converts standard XSD date formats to characters suitable for output.

ms:format-time

Converts standard XSD time formats to characters suitable for output.