viewport-030 (AB)
Test
p:viewport with a pipe to current on a mixed input port.
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" pipe="@viewport"/>
<p:viewport match="par" name="viewport">
<p:with-input>
<doc>
<par>Text</par>
<par>Text</par>
<par>Text</par>
</doc>
</p:with-input>
<p:identity name="two">
<p:with-input>
<p:inline>
<title xml:id="section-{p:iteration-position()}"/>
</p:inline>
<p:pipe port="current"/>
</p:with-input>
</p:identity>
<p:wrap-sequence name="wrapper" wrapper="section"/>
</p:viewport>
</p:declare-step>
Result
<doc xmlns:t="http://xproc.org/ns/testsuite/3.0">
<section>
<title xml:id="section-1"/>
<par>Text</par>
</section>
<section>
<title xml:id="section-2"/>
<par>Text</par>
</section>
<section>
<title xml:id="section-3"/>
<par>Text</par>
</section>
</doc>
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="doc">The root element is not 'doc'.</s:assert>
<s:assert test="count(doc/*)=3 and count(doc/section)=3">Root element does not have 3 children 'section'.</s:assert>
<s:assert test="doc/section[1]/title/@xml:id='section-1'">title/@xml:id of section[1] is not 'section-1'.</s:assert>
<s:assert test="doc/section[2]/title/@xml:id='section-2'">title/@xml:id of section[2] is not 'section-2'.</s:assert>
<s:assert test="doc/section[3]/title/@xml:id='section-3'">title/@xml:id of section[3] is not 'section-3'.</s:assert>
<s:assert test="doc/section/par/text()='Text'">Not all par elements are 'text'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 10 Jun 2021, Achim Berndzen
- Added attribute 'queryBinding' to schematron's schema.
- 13 Apr 2020, Achim Berndzen
- New test