Defining Namespace Prefixes for Extension Functions

Defining Namespace Prefixes for Extension Functions

To use the Microsoft XPath Extension functions, you must declare the appropriate namespaces in an XSLT style sheet, as follows:

<xsl:stylesheet xmlns:xsl=""

It is important that the namespace URI, urn:schemas-microsoft-com:xslt, must appear exactly as shown above. It is reasonable to choose ms as the namespace prefix, although you can use a name of your choosing for the prefix. For example, the following code snippet is equally valid:

<xsl:stylesheet version="1.0"
<xsl:template match="*">
   <xsl:value-of select="ext:type-local-name()"/>

The namespace prefix can also be defined within the XSLT element, as follows.

<xsl:for-each select="//[ms:type-local-name()='ID'] xmlns:ms="urn:schemas-microsoft-com:xslt">

When using the DOM, the namespace prefix is declared using the setProperty method of IXMLDOMDocument2.

docObj.setProperty("SelectionNamespaces", "xmlns:ms='urn:schemas-microsoft-com:xslt'")

Build Date:


Community Additions

© 2016 Microsoft