Tests types in xquery result are set correctly (Part 1)
Test ab-xquery-039.xml is expected to pass.
It requires the following features: xquery_3_1.
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0" exclude-inline-prefixes="#all">
<p:output port="result" sequence="true" serialization="map{'indent' : true()}"/>
<p:xquery version="3.1">
<p:with-input port="source">
<p:empty/>
</p:with-input>
<p:with-input port="query" xml:base="http://xquery-uri">
<p:inline content-type="text/plain">
declare namespace xs ="http://www.w3.org/2001/XMLSchema";
(xs:untypedAtomic('untyped'), (:1:)
xs:dateTime('2006-05-03T13:20:00'), (:2:)
xs:date('2006-05-03'), (:3:)
xs:time('13:30:00'), (:4:)
xs:yearMonthDuration('P3Y5M'), (:5:)
xs:dayTimeDuration('P2DT3H'), (:6:)
xs:float('3.0'), (:7:)
xs:double('42.42'), (:8:)
xs:decimal('42'), (:9:)
xs:gYearMonth('2026-06'), (:10:)
xs:gYear('2025'), (:11:)
xs:gMonthDay('--05-03'), (:12:)
xs:gDay('---04'), (:13:)
xs:gMonth('--06 '), (:14:)
xs:boolean('false'), (:15:)
xs:base64Binary('0CD7'), (:16:)
xs:hexBinary('0CD7'), (:17:)
xs:anyURI('http://test'), (:18:)
QName('http://test', 'name')) (:19:)
</p:inline>
</p:with-input>
</p:xquery>
<p:for-each>
<p:choose>
<p:when test="p:iteration-position()=1">
<p:identity>
<p:with-input>
<untypedAtomic-test>{. instance of xs:untypedAtomic}</untypedAtomic-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=2">
<p:identity>
<p:with-input>
<dateTime-test>{. instance of xs:dateTime}</dateTime-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=3">
<p:identity>
<p:with-input>
<date-test>{. instance of xs:date}</date-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=4">
<p:identity>
<p:with-input>
<time-test>{. instance of xs:time}</time-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=5">
<p:identity>
<p:with-input>
<yearMonthDuration-test>{. instance of xs:yearMonthDuration}</yearMonthDuration-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=6">
<p:identity>
<p:with-input>
<dayTimeDuration-test>{. instance of xs:dayTimeDuration}</dayTimeDuration-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=7">
<p:identity>
<p:with-input>
<float-test>{. instance of xs:float}</float-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=8">
<p:identity>
<p:with-input>
<double-test>{. instance of xs:double}</double-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=9">
<p:identity>
<p:with-input>
<decimal-test>{. instance of xs:decimal}</decimal-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=10">
<p:identity>
<p:with-input>
<gYearMonth-test>{. instance of xs:gYearMonth}</gYearMonth-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=11">
<p:identity>
<p:with-input>
<gYear-test>{. instance of xs:gYear}</gYear-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=12">
<p:identity>
<p:with-input>
<gMonthDay-test>{. instance of xs:gMonthDay}</gMonthDay-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=13">
<p:identity>
<p:with-input>
<gDay-test>{. instance of xs:gDay}</gDay-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=14">
<p:identity>
<p:with-input>
<gMonth-test>{. instance of xs:gMonth}</gMonth-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=15">
<p:identity>
<p:with-input>
<boolean-test>{. instance of xs:boolean}</boolean-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=16">
<p:identity>
<p:with-input>
<base64Binary-test>{. instance of xs:base64Binary}</base64Binary-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=17">
<p:identity>
<p:with-input>
<hexBinary-test>{. instance of xs:hexBinary}</hexBinary-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=18">
<p:identity>
<p:with-input>
<anyURI-test>{. instance of xs:anyURI}</anyURI-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=19">
<p:identity>
<p:with-input>
<QName-test>{. instance of xs:QName}</QName-test>
</p:with-input>
</p:identity>
</p:when>
<p:otherwise>
<p:identity>
<p:with-input>
<unidentified-value/>
</p:with-input>
</p:identity>
</p:otherwise>
</p:choose>
</p:for-each>
<p:wrap-sequence wrapper="tests"/>
</p:declare-step>
<s:schema xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<s:pattern>
<s:rule context="/">
<s:assert test="tests">Root element is not 'tests'.</s:assert>
<s:assert test="count(tests/unidentified-value)=0">There are identified values. Please check pipeline.</s:assert>
<s:assert test="tests/untypedAtomic-test/text()='true'">document[1] is not xs:untypedAtomic</s:assert>
<s:assert test="tests/dateTime-test/text()='true'">document[2] is not xs:dateTime</s:assert>
<s:assert test="tests/date-test/text()='true'">document[3] is not xs:date</s:assert>
<s:assert test="tests/time-test/text()='true'">document[4] is not xs:time</s:assert>
<s:assert test="tests/yearMonthDuration-test/text()='true'">document[5] is not xs:yearMonthDuration</s:assert>
<s:assert test="tests/dayTimeDuration-test/text()='true'">document[6] is not xs:dayTimeDuration</s:assert>
<s:assert test="tests/float-test/text()='true'">document[7] is not xs:float</s:assert>
<s:assert test="tests/double-test/text()='true'">document[8] is not xs:double</s:assert>
<s:assert test="tests/decimal-test/text()='true'">document[9] is not xs:decimal</s:assert>
<s:assert test="tests/gYearMonth-test/text()='true'">document[10] is not xs:gYearMonth</s:assert>
<s:assert test="tests/gYear-test/text()='true'">document[11] is not xs:gYear</s:assert>
<s:assert test="tests/gMonthDay-test/text()='true'">document[12] is not xs:gMonthDay</s:assert>
<s:assert test="tests/gDay-test/text()='true'">document[13] is not xs:gDay</s:assert>
<s:assert test="tests/gMonth-test/text()='true'">document[14] is not xs:gMonth</s:assert>
<s:assert test="tests/boolean-test/text()='true'">document[15] is not xs:boolean</s:assert>
<s:assert test="tests/base64Binary-test/text()='true'">document[16] is not xs:base64Binary</s:assert>
<s:assert test="tests/hexBinary-test/text()='true'">document[17] is not xs:hexBinary</s:assert>
<s:assert test="tests/anyURI-test/text()='true'">document[18] is not xs:anyURI</s:assert>
<s:assert test="tests/QName-test/text()='true'">document[19] is not xs:QName</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Initial commit