ms:schema-info-available Function

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XPath Reference

ms:schema-info-available Function

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

boolean ms:xsd-info-available()

Remarks

The following expression returns true for all nodes with XSD-type information.

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

Example

The following example uses an XSLT template rule to select all the elements in books.xml, and to output the elements' data types and the namespace URI as defined in books.xsd.

XML File (books.xml)

Use books.xml.

XSD File (books.xsd)

Use books.xsd.

HTML File (books.html)

The HTML file is the same as that listed in the ms:type-namespace-uri([node-set]) Function topic.

XSLT File (books.xslt)

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" 
     xmlns:ms="urn:schemas-microsoft-com:xslt"   
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="text()"/>
  <xsl:output method="html"   
     omit-xml-declaration="yes"/>

  <xsl:template match="/">
     <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="*">
    <!-- process only those element whose schema-info is available. -->
    <xsl:if test="ms:schema-info-available()">
      <DIV>
          <xsl:value-of select="name()"/> is of
          "<xsl:value-of select="ms:type-local-name()"/>" in
          "<xsl:value-of select="ms:type-namespace-uri()"/>"
      </DIV>
    </xsl:if>
    <xsl:apply-templates/>
  </xsl:template>

</xsl:stylesheet>

Output

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"

The output here is the same as that shown in the ms:type-namespace-uri topic, because the schema information is available for evey element.

See Also

Using XPath Extension Functions for XSD Support | Data Types in Schemas | XML Schema Reference (XSD) | XML Data Types Reference