Tests types in xquery result are set correctly (Part 3)
Test ab-xquery-041.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:string('text'), (:1:)
xs:normalizedString('text'), (:2:)
xs:token('text'), (:3:)
xs:language('en'), (:4:)
xs:NMTOKEN('text'), (:5:)
xs:Name('name'), (:6:)
xs:NCName('name') (:7:)
)
</p:inline>
</p:with-input>
</p:xquery>
<p:for-each>
<p:choose>
<p:when test="p:iteration-position()=1">
<p:identity>
<p:with-input>
<string-test>{. instance of xs:string}</string-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=2">
<p:identity>
<p:with-input>
<normalizedString-test>{. instance of xs:normalizedString}</normalizedString-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=3">
<p:identity>
<p:with-input>
<token-test>{. instance of xs:token}</token-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=4">
<p:identity>
<p:with-input>
<language-test>{. instance of xs:language}</language-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=5">
<p:identity>
<p:with-input>
<NMTOKEN-test>{. instance of xs:NMTOKEN}</NMTOKEN-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=6">
<p:identity>
<p:with-input>
<Name-test>{. instance of xs:Name}</Name-test>
</p:with-input>
</p:identity>
</p:when>
<p:when test="p:iteration-position()=7">
<p:identity>
<p:with-input>
<NCName-test>{. instance of xs:NCName}</NCName-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/string-test/text()='true'">document[1] is not xs:string</s:assert>
<s:assert test="tests/normalizedString-test/text()='true'">document[2] is not xs:normalizedString</s:assert>
<s:assert test="tests/token-test/text()='true'">document[3] is not xs:token</s:assert>
<s:assert test="tests/language-test/text()='true'">document[4] is not xs:language</s:assert>
<s:assert test="tests/NMTOKEN-test/text()='true'">document[5] is not xs:NMTOKEN</s:assert>
<s:assert test="tests/Name-test/text()='true'">document[6] is not xs:Name</s:assert>
<s:assert test="tests/NCName-test/text()='true'">document[7] is not xs:NCName</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Initial commit