<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/ab-with-input-select-004.xml"
        name="ab-with-input-select-004.xml"
        expected="pass">
   <t:info>
      <t:title>with-input-select-004</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2021-06-10</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Added attribute 'queryBinding' to schematron's schema.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2018-10-12</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Fixing broken test (namespace removed)</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2018-02-02T17:42:37+01:00</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>added new tests</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Test select on p:with-input select="text()"</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:c="http://www.w3.org/ns/xproc-step"
                      xmlns:p="http://www.w3.org/ns/xproc"
                      version="3.0">
         <p:output port="result"/>
         <p:identity>
            <p:with-input select="*/text()">
               <doc><!-- A comment -->
                  <element1 att="att"/>
                  <?pi target?>
                        A text node
                        
                  <element2/>
               </doc>
            </p:with-input>
         </p:identity>
         <p:wrap-sequence wrapper="c:result"/>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://purl.oclc.org/dsdl/schematron"
                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())=count(text())">c:result does not have only text node children.</s:assert>
               <s:assert test="normalize-space(string-join(text(),''))='A text node'">The normalized text is not 'A next node'.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="ab-with-input-select-004.xml">
      <c:result xmlns:c="http://www.w3.org/ns/xproc-step">
                  
                  
                  
                        A text node
                        
                  
               </c:result>
   </t:result>
</t:test>
