Tests types of variables are set correctly (Part 3)
Test ab-xquery-038.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">
<p:output port="result"/>
<p:xquery version="3.1" parameters="map{'variable' : (xs:string('text'), xs:normalizedString('text'), xs:token('text'), xs:language('en'), xs:NMTOKEN('text'), xs:Name('name'), xs:NCName('name') )}">
<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";
declare variable $variable external;
<tests>
<string-test>{{$variable[1] instance of xs:string}}</string-test>
<normalized-string-test>{{$variable[2] instance of xs:normalizedString}}</normalized-string-test>
<token-test>{{$variable[3] instance of xs:token}}</token-test>
<language-test>{{$variable[4] instance of xs:language}}</language-test>
<NMTOKEN-test>{{$variable[5] instance of xs:NMTOKEN}}</NMTOKEN-test>
<name-test>{{$variable[6] instance of xs:Name}}</name-test>
<ncname-test>{{$variable[7] instance of xs:NCName}}</ncname-test>
</tests>
</p:inline>
</p:with-input>
</p:xquery>
</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="tests/string-test/text()='true'">$variable[1] is not xs:string</s:assert>
<s:assert test="tests/normalized-string-test/text()='true'">$variable[2] is not xs:normalizedString</s:assert>
<s:assert test="tests/token-test/text()='true'">$variable[3] is not xs:token</s:assert>
<s:assert test="tests/language-test/text()='true'">$variable[4] is not xs:language</s:assert>
<s:assert test="tests/NMTOKEN-test/text()='true'">$variable[5] is not xs:NMTOKEN</s:assert>
<s:assert test="tests/name-test/text()='true'">$variable[6] is not xs:Name</s:assert>
<s:assert test="tests/ncname-test/text()='true'">$variable[7] is not xs:NCName</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Initial commit