ms:type-is Function

Tests whether the current node's data type belongs to the given namespace. The data type and the namespace are specified in the arguments.

          boolean ms:type-is(string URI, string local-name)

string URI
The namespace URI for the data type against which the current data type is evaluated.

string local-name
The local name of the data type against which the current data type is evaluated.

The function returns true if the current node is of the specified data type belonging to the given namespace. Otherwise it returns false. If local-name refers to a data type undeclared in the given namespace (URI), the function returns false. Nameless data types defined in the given namespace cause the function to return false as well.

This function is aware of XSD inheritence, so that if type "b" is derived from "a", then for the node of type "b", type-is("", "a") returns true.

The following example uses an XSLT template rule to select all the elements in books.xml whose data type is date, as defined in books.xsd. The example also shows how to do the query using an XML DOM instance.

XML File (books.xml)

Use books.xml.

XSD File (books.xsd)

Use books.xsd.

XSLT File (books.xslt)

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" 

  <xsl:template match="text()"/>

  <xsl:output method="html"   

  <xsl:template match="/">
     <H3>nodes of date data types:</H3>
     <xsl:apply-templates select=

  <xsl:template match="*">
          <xsl:value-of select="name()"/> =
          <xsl:value-of select="."/>


HTML File (books.html)

The HTML file contains a JScript that handles loading XML, XSLT, and XSD files.

      function init() {
       try {
         var objxsd = new ActiveXObject("Msxml2.XMLSchemaCache.6.0");
         var objxml = new ActiveXObject("Msxml2.DOMDocument.6.0");
         var objxsl = new ActiveXObject("Msxml2.DOMDocument.6.0");

         // namespace uri ("urn:books") must be declared as one of the
         // namespace delarations in the "books.xml" that is an instance
         // of "books.xsd"
         objxsd.add("urn:books", "books.xsd");
         objxml.schemas = objxsd;
         objxml.setProperty("SelectionLanguage", "XPath");

         // Select nodes of 'date" type using DOM:
         var nodes = objxml.selectNodes("//*[ms:type-is(\
         result ="<h2>used in a DOM</h2> ";
         result += "<h3>nodes of date data types</h3>";
         for (i=0; i<nodes.length; i++) {
            result += "<DIV>"+nodes.item(i).nodeName 

         // Select nodes of 'date" type using XSLT:
         result += "<h2>Used in an XSLT</h2>";
         result += objxml.transformNode(objxsl);
         document.body.innerHTML = result;
       catch (e) {

  <body onload="init()">


Publish_date = 2000-10-01

Build Date: