pipelineception-001

Tests that pipelineception works.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:ex="http://example.com/ns" xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" name="main" version="3.0">
   <p:output port="result" sequence="true"/>
   <p:declare-step type="ex:process">
      <p:input port="source" content-types="xml html"/>
      <p:output port="result" content-types="xml html"/>
      <p:add-attribute attribute-name="do"
                       attribute-value="something"/>
   </p:declare-step>
   <p:xslt>
      <p:with-input port="source">
         <doc>
            <could/>
         </doc>
      </p:with-input>
      <p:with-input port="stylesheet">
         <xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
                         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                         exclude-result-prefixes="#all" version="3.0">
            <xsl:output method="xml" encoding="utf-8"
                        indent="no"/>
            <xsl:mode on-no-match="shallow-copy"/>
            <xsl:template match="doc">
               <doc>
                  <title>What would I do?</title>
                  <xsl:apply-templates/>
               </doc>
            </xsl:template>
            <xsl:template match="could">
               <xsl:sequence select="ex:process(.)?result"/>
            </xsl:template>
         </xsl:stylesheet>
      </p:with-input>
   </p:xslt>
</p:declare-step>

Result

<doc xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <title>What would I do?</title>
   <could xmlns:cx="http://xmlcalabash.com/ns/extensions"
          xmlns:ex="http://example.com/ns" do="something"/>
</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:ns prefix="svg" uri="http://www.w3.org/2000/svg"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="doc">The root is wrong.</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="/doc">
         <s:assert test="could[@do = 'something']">The attribute hasn’t been added.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

14 Sep 2025, Norm Tovey-Walsh
Created test.