タイプを使用してサブタイプである要素を選択しようとしているので、xs:integerとxs:floatのサブタイプを持つテストドキュメントがあります。
スキーマで定義されたタイプを使用するようにXQueryに指示するにはどうすればよいですか?
(私がoXygenとSaxon-SAを使用していることは関連があるかもしれません)
入力ドキュメント:
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="test-inherit.xsd">
<int>4</int>
<rest-int>5</rest-int>
<rest-float>6</rest-float>
</root>
WXSスキーマ:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="int" type="xs:integer"/>
<xs:element name="rest-int" type="rest-int"/>
<xs:element name="rest-float" type="rest-float"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="rest-int">
<xs:restriction base="xs:integer">
<xs:maxInclusive value="10"></xs:maxInclusive>
<xs:minInclusive value="0"></xs:minInclusive>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="rest-float">
<xs:restriction base="xs:float">
<xs:maxInclusive value="10"></xs:maxInclusive>
<xs:minInclusive value="0"></xs:minInclusive>
</xs:restriction>
</xs:simpleType>
</xs:schema>
XQuery:
for $integer in doc("test-inherit.xml")//element(xs:integer)
return <integer>{$integer}</integer>