With-input-select 002
Test is expected to pass.
The pipeline
<p:declare-step xmlns:c="http://www.w3.org/ns/xproc-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" sequence="true"/>
<p:option name="blank" select="''"/>
<p:option name="class" select="concat($blank, 'b')"/>
<p:identity>
<p:with-input port="source"
select="//c:chapter[@class=$class]">
<p:inline>
<document xmlns="http://www.w3.org/ns/xproc-step">
<chapter class="a">one</chapter>
<chapter class="a">two</chapter>
<chapter class="b">three</chapter>
</document>
</p:inline>
</p:with-input>
</p:identity>
<p:wrap-sequence wrapper="c:result"/>
</p:declare-step>
Result
<c:result xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<chapter xmlns="http://www.w3.org/ns/xproc-step"
class="a">one</chapter>
<chapter xmlns="http://www.w3.org/ns/xproc-step"
class="a">two</chapter>
</c: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:ns prefix="c"
uri="http://www.w3.org/ns/xproc-step"/>
<s:pattern>
<s:rule context="/*">
<s:assert test="self::c:result">The pipeline root is not c:result.</s:assert>
<s:assert test="count(c:chapter) = 2">There should be 1 chapter.</s:assert>
<s:assert test="c:chapter[1] = 'one'">First chapter must be ‘one’</s:assert>
<s:assert test="c:chapter[2] = 'two'">Seocnd chapter must be ‘two’</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 10 Jun 2021, Achim Berndzen
- Added attribute 'queryBinding' to schematron's schema.
- 29 Sep 2017, Norman Walsh
- Add tests for @select on p:with-input