p:www-form-urldecode 003 (AB)
Tests p:www-form-urldecode
Test is expected to pass.
The pipeline
<p:declare-step xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:t="http://xproc.org/ns/testsuite/3.0" name="pipeline" version="3.0"
exclude-inline-prefixes="map">
<p:output port="result"/>
<p:www-form-urldecode>
<p:with-option name="value"
select="'key=value1&key=value2'"/>
</p:www-form-urldecode>
<p:identity>
<p:with-input>
<result>
<keys>{map:keys(.)}</keys>
<count>{count(.?key)}</count>
<first>{.?key[1]}</first>
<second>{.?key[2]}</second>
</result>
</p:with-input>
</p:identity>
</p:declare-step>
Result
<result xmlns:t="http://xproc.org/ns/testsuite/3.0">
<keys>key</keys>
<count>2</count>
<first>value1</first>
<second>value2</second>
</result>
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:pattern>
<s:rule context="/">
<s:assert test="result/keys/text()='key'">The content of 'keys' is not 'key'.</s:assert>
<s:assert test="result/count/text()='2'">The content of 'count' is not '2'.</s:assert>
<s:assert test="result/first/text()='value1'">The content of 'first' is not 'value1'.</s:assert>
<s:assert test="result/second/text()='value2'">The content of 'second' is not 'value2'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 22 Jul 2021, Achim Berndzen
- New test added.