Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ms:schema-info-available Function

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


          boolean ms:schema-info-available()

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

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

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 every element.




Build Date:

2012-08-02
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.