<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/ab-with-input-select-010.xml"
        name="ab-with-input-select-010.xml"
        expected="pass">
   <t:info>
      <t:title>with-input-select-010</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2021-11-27</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Fixed test as consequence of pr#1042.</p>
            </t:description>
         </t:revision>
         <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>2019-12-14</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Fixed test by declaring prefix "xs".</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2019-07-13</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Changed test: Atomic values are now JSON documents.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2019-01-12</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Added test</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests select on p:with-input/@select resulting in an atomic value.</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                      xmlns:xs="http://www.w3.org/2001/XMLSchema"
                      version="3.0">
         <p:output port="result"/>
         <p:identity>
            <p:with-input select="32">
               <doc/>
            </p:with-input>
         </p:identity>
         <p:identity>
            <p:with-input>
               <result>{if (. instance of xs:integer) then .+10 else 0}</result>
            </p:with-input>
         </p:identity>
      </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="p" uri="http://www.w3.org/ns/xproc"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="result">Document root is not 'result'.</s:assert>
               <s:assert test="result/text()='42'">'result' does not a text child with value '42'.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="ab-with-input-select-010.xml">
      <result xmlns:xs="http://www.w3.org/2001/XMLSchema">42</result>
   </t:result>
</t:test>
