<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <t:info>
      <t:title>with-input-select-006</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-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>Tests that content-type is changed to application/xml when selecting from XLST document.</p>
   </t:description>
   <t:pipeline>
      <p:declare-step version="3.0"
                      xmlns:p="http://www.w3.org/ns/xproc"
                      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <p:output port="result"/>
         <p:identity>
            <p:with-input select="/xsl:stylesheet/xsl:template[1]">
               <p:inline content-type="application/xslt+xml">
                  <xsl:stylesheet version="2.0">
                     <xsl:template match="/">
                        <xsl:text>result</xsl:text>
                     </xsl:template>
                  </xsl:stylesheet>
               </p:inline>
            </p:with-input>
         </p:identity>
         <p:cast-content-type content-type="application/xml">
            <p:with-input select="p:document-properties(.)"/>
         </p:cast-content-type>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema queryBinding="xslt2"
                xmlns:s="http://purl.oclc.org/dsdl/schematron"
                xmlns="http://www.w3.org/1999/xhtml">
         <s:ns prefix="j"
               uri="http://www.w3.org/2005/xpath-functions"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="count(*) = 1">Document does not have exactly one child element.</s:assert>
               <s:assert test="j:map">Root element is not named 'j:map'.</s:assert>
            </s:rule>
            <s:rule context="/j:map">
               <s:assert test="j:string[@key='content-type'] ='application/xml'">Content type is not 'application/xml'.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
</t:test>