expand-templates-001

Tests ex:expand-template.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:ex="http://exproc.org/ns/steps"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" name="main" version="3.0">
   <p:import href="https://xmlcalabash.com/ext/library/expand-templates.xpl"/>
   <p:output port="result"/>
   <ex:expand-templates>
      <p:with-input>
         <p:inline exclude-inline-prefixes="#all">
            <doc>
               <sum>{{$x+4}}</sum>
               <greeting>{{$greeting}}</greeting>
            </doc>
         </p:inline>
      </p:with-input>
      <p:with-option name="variables"
                     select="map{'x':3, 'greeting': 'Hello, world'}"/>
   </ex:expand-templates>
</p:declare-step>

Result

<doc xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <sum>7</sum>
   <greeting>Hello, world</greeting>
</doc>

Schematron checks

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
          xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="doc">The root is wrong.</s:assert>
         <s:assert test="doc/sum = '7'">The sum is wrong.</s:assert>
         <s:assert test="doc/greeting = 'Hello, world'">The greeting is wrong.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

15 Nov 2025, Norm Tovey-Walsh
Created test.