p:xquery 026 (AB)
Tests p:xquery: JSON array can be a result in XQuery 3.1
Test is expected to pass.
The pipeline
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
<p:output port="result"/>
<p:xquery>
<p:with-input port="source">
<p:empty/>
</p:with-input>
<p:with-input port="query">
<p:inline content-type="text/plain">
['one', 'two']
</p:inline>
</p:with-input>
</p:xquery>
<p:cast-content-type content-type="application/xml"/>
</p:declare-step>
Result
<array xmlns="http://www.w3.org/2005/xpath-functions"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<string>one</string>
<string>two</string>
</array>
Schematron checks
<s:schema xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:t="http://xproc.org/ns/testsuite/3.0"
queryBinding="xslt2">
<s:ns prefix="xpath"
uri="http://www.w3.org/2005/xpath-functions"/>
<s:pattern>
<s:rule context="/">
<s:assert test="xpath:array">Root element is not 'xpath:array'.</s:assert>
<s:assert test="xpath:array/*[1]/name()='string'">First child is not 'string'.</s:assert>
<s:assert test="xpath:array/*[1]/text()='one'">First child is does not have text 'one'.</s:assert>
<s:assert test="xpath:array/*[2]/name()='string'">Second child is not 'string'.</s:assert>
<s:assert test="xpath:array/*[2]/text()='two'">Second child is does not have text 'two'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 10 Jun 2021, Achim Berndzen
- Added attribute 'queryBinding' to schematron's schema.
- 13 Sep 2019, Achim Berndzen
- Tests for p:xquery (Partly ported from 1.0)