p:wrap 003 (AB)
Tests p:wrap
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:wrap match="p:option" wrapper="p:option-wrapper"
group-adjacent="local-name()">
<p:with-input>
<p:inline>
<p:wrap>
<p:option name="target" value="p:option"/>
<p:option name="name"
value="option-wrapper"/>
</p:wrap>
</p:inline>
</p:with-input>
</p:wrap>
</p:declare-step>
Result
<p:wrap xmlns:p="http://www.w3.org/ns/xproc"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<p:option-wrapper>
<p:option name="target" value="p:option"/>
<p:option name="name" value="option-wrapper"/>
</p:option-wrapper>
</p:wrap>
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="p" uri="http://www.w3.org/ns/xproc"/>
<s:pattern>
<s:rule context="/">
<s:assert test="p:wrap">Root element is not 'p:wrap'.</s:assert>
<s:assert test="p:wrap/p:option-wrapper">Element 'p:wrap' should have a child 'p:option-wrapper'.></s:assert>
<s:assert test="count(p:wrap/p:option-wrapper/p:option)=2">Element 'p:option-wrapper' does not have two children 'p:option'.</s:assert>
<s:assert test="count(p:wrap/*)=1"> Element 'p:wrap' should have only one child element.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 10 Jun 2021, Achim Berndzen
- Added attribute 'queryBinding' to schematron's schema.
- 25 Aug 2019, Achim Berndzen
- Tests for p:wrap (Partly ported from 1.0)