<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/inline-tvt.xml"
        name="inline-tvt.xml"
        expected="pass">
   <t:info>
      <t:title>Inline TVTs</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2021-10-01</t:date>
            <t:author>
               <t:name>Norman Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Updated the underlying pipeline to use <code>p:inline-expand-text</code>.</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>2017-09-24T17:47:42+01:00</t:date>
            <t:author>
               <t:name>Norman Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Port my test suite; add documentation and schemas</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:pipeline>
      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="main" version="3.0">
         <p:output port="result"/>
         <p:identity name="one">
            <p:with-input port="source">
               <p:inline>
                  <doc>There are <t>elements</t> in here. A couple of <t>elements</t>.</doc>
               </p:inline>
            </p:with-input>
         </p:identity>
         <p:variable name="bar" select="count(//*)"/>
         <p:identity name="two">
            <p:with-input port="source">
               <p:inline>
                  <doc count="{$bar}">Counts the number of nodes.
        The number of the nodes is <number>{$bar}</number>.
        <toggle class="{$bar}" p:inline-expand-text="false">{$bar}</toggle>
                  </doc>
               </p:inline>
            </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="self::doc">The pipeline root is not doc.</s:assert>
            </s:rule>
            <s:rule context="number">
               <s:assert test=". = 3">The number of nodes in the TVT is incorrect.</s:assert>
            </s:rule>
            <s:rule context="toggle">
               <s:assert test="@class = 3">The number of nodes in the toggle AVT is incorrect.</s:assert>
            </s:rule>
            <s:rule context="toggle">
               <s:assert test=". = '{{$bar}}'">The toggled content is incorrect.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="inline-tvt.xml">
      <doc count="3">Counts the number of nodes.
        The number of the nodes is <number>3</number>.
        <toggle xmlns:p="http://www.w3.org/ns/xproc" class="3">{$bar}</toggle>
      </doc>
   </t:result>
</t:test>
