p:www-form-urldecode 002 (AB)
Tests p:www-form-urldecode
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" name="pipeline" version="3.0">
<p:output port="result"/>
<p:www-form-urldecode>
<p:with-option name="value"
select="'key1=value1&key2=value2'"/>
</p:www-form-urldecode>
<p:cast-content-type content-type="application/xml"/>
</p:declare-step>
Result
<map xmlns="http://www.w3.org/2005/xpath-functions"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<string key="key1">value1</string>
<string key="key2">value2</string>
</map>
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="map"
uri="http://www.w3.org/2005/xpath-functions"/>
<s:pattern>
<s:rule context="/">
<s:assert test="map:map">Root element is not 'map:map'.</s:assert>
<s:assert test="map:map/map:string[@key='key1']">There is no 'string' child with @key='key1'.</s:assert>
<s:assert test="map:map/map:string[@key='key1']/text()='value1'">The value of element 'key1' is not 'value1'.</s:assert>
<s:assert test="map:map/map:string[@key='key2']">There is no 'string' child with @key='key2'.</s:assert>
<s:assert test="map:map/map:string[@key='key2']/text()='value2'">The value of element 'key2' is not 'value2'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 20 Jul 2021, Achim Berndzen
- New test added.