<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
        features="xslt-2"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <t:info>
      <t:title>AB-xslt-076</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-10-04</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Added tests for p:xslt with version="2.0".</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests passing a node as parameter.</p>
   </t:description>
   <t:pipeline>
      <p:declare-step version="3.0"
                      xmlns:p="http://www.w3.org/ns/xproc">
         <p:output port="result"/>
         <p:variable name="node"
                     select=".">
            <answer>42</answer>
         </p:variable>
         <p:xslt version="2.0"
                 parameters="map{'val' :$node }">
            <p:with-input>
               <doc/>
            </p:with-input>
            <p:with-input port="stylesheet">
               <xsl:stylesheet version="2.0"
                               xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                  <xsl:param name="val"
                             required="yes"/>
                  <xsl:template match="doc">
                     <xsl:copy-of select="$val"/>
                  </xsl:template>
               </xsl:stylesheet>
            </p:with-input>
         </p:xslt>
      </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:pattern>
            <s:rule context="/">
               <s:assert test="/answer">The document root is not 'answer'.</s:assert>
               <s:assert test="/answer/text()='42'">The answer is not 42.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
</t:test>