<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="p-inline-002.xml"
        name="p-inline-002.xml"
        expected="pass">
   <t:info>
      <t:title>p:inline 002</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>2019-11-23</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Changed test from p:document-properties-document() to p:document-properties().</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2018-10-22</t:date>
            <t:author initials="ndw">
               <t:name>Norman Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Fixed result document
            (
                  <code>c:document-properties</code>, not 
                  <code>p:document-properties</code>)</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-07-07T17:01:39+02:00</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>=Adapted tests to PR #422</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2018-05-02T18:16:03+02:00</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Change test with document-properties to map{xs:QName, item()}</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2018-04-03T16:57:32+02:00</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Some new tests.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2018-02-18T08:23:14+01:00</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Reversed @pipe-substructure. (-&gt;Prague 2018)</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>
            <t:date>2017-10-09T08:08:13-07:00</t:date>
            <t:author>
               <t:name>Norman Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>New tests for p:inline</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:pipeline>
      <p:declare-step xmlns:c="http://www.w3.org/ns/xproc-step"
                      xmlns:p="http://www.w3.org/ns/xproc"
                      name="main"
                      version="3.0">
         <p:output port="result" sequence="true"/>
         <p:identity name="inline">
            <p:with-input port="source">
               <p:inline content-type="text/plain">Hello, world.</p:inline>
            </p:with-input>
         </p:identity>
         <p:cast-content-type content-type="application/xml" name="properties">
            <p:with-input port="source" select="p:document-properties(.)"/>
         </p:cast-content-type>
         <p:wrap-sequence wrapper="c:result">
            <p:with-input port="source" pipe="@properties @inline"/>
         </p:wrap-sequence>
      </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="j" uri="http://www.w3.org/2005/xpath-functions"/>
         <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="j:map">The result does not include 'j:map'.</s:assert>
               <s:assert test="(text())[1] = 'Hello, world.'">The result does not have the required text</s:assert>
               <s:assert test="j:map/j:string[@key='content-type']/text() = 'text/plain'">
                     The content type of the result is not text/plain
               </s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="p-inline-002.xml">
      <c:result xmlns:c="http://www.w3.org/ns/xproc-step">
         <map xmlns="http://www.w3.org/2005/xpath-functions">
            <string key="base-uri">file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/tests/p-inline-002.xml</string>
            <string key="content-type">text/plain</string>
         </map>Hello, world.</c:result>
   </t:result>
</t:test>
