with-input-select-002

Test select on p:with-input select="comment()"

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"/>
   <p:identity>
      <p:with-input select="*/comment()">
         <doc>
            <element1 att="att"/>
            
                        A text node
                        
                  <element2/>
         </doc>
      </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"></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="count(*) = 1">Document does not have exactly one child element.</s:assert>
         <s:assert test="*[1]/name()='c:result'">Root element is not named 'c:result'.</s:assert>
      </s:rule>
      <s:rule context="/c:result">
         <s:assert test="count(node())=1">c:result does not have exactly one child node.</s:assert>
         <s:assert test="count(comment()) = 1">c:result does not have exactly one comment as child.</s:assert>
         <s:assert test="comment()= ' A comment '">Text of comment is not ' A comment '.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen
Added attribute 'queryBinding' to schematron's schema.
12 Oct 2018, Achim Berndzen
Fixing broken test (namespace removed)
02 Feb 2018, Achim Berndzen
added new tests