現在のノードの XSD 情報があれば、true
を返します。
boolean ms:schema-info-available()
解説
次の式は、XSD 型情報を持つすべてのノードに対して true
を返します。
"//*[ms:schema-info-available()]"
例
次の例では、XSLT テンプレート規則を使用して books.xml のすべての要素を選択し、その要素のデータ型と、books.xsd で定義されている名前空間 URI を出力します。
XML ファイル (books.xml)
books.xml を使用します。
XSD ファイル (books.xsd)
books.xsd を使用します。
HTML ファイル (books.html)
この HTML ファイルは、「ms:type-namespace-uri([node-set]) 関数」に示されている HTML ファイルと同じです。
XSLT ファイル (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>
出力
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"
この出力では、スキーマ情報がすべての要素について提供されているため、ms:type-namespace-uri
に関するトピックで示されているものと同一になります。
参照
リファレンス
XML スキーマ (XSD) リファレンス
XML データ型リファレンス