pipelineception-003

Tests that pipelineception works.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:ex="http://example.com/ns"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0"
                xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-inline-prefixes="#all"
                name="main" version="3.0">
   <p:output port="result" sequence="true"/>
   <p:declare-step type="ex:hash">
      <p:output port="result" content-types="text"/>
      <p:option name="text" as="xs:string" required="true"/>
      <p:option name="algorithm" as="xs:string"
                select="'sha'"/>
      <p:option name="version" as="xs:string?"
                select="if ($algorithm = 'sha') then '256' else ()"/>
      <p:hash algorithm="{$algorithm}" value="{$text}"
              match="/doc">
         <p:with-option name="version"
                        select="$version"/>
         <p:with-input>
            <doc/>
         </p:with-input>
      </p:hash>
   </p:declare-step>
   <p:xslt>
      <p:with-input port="source">
         <doc>
            <hash>Hello, world.</hash>
         </doc>
      </p:with-input>
      <p:with-input port="stylesheet"
                    href="../documents/pception.xsl"/>
   </p:xslt>
</p:declare-step>

Result

<doc xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <p>The hash of “Hello, world.” is:</p>
   <hash>f8c3bf62a9aa3e6fc1619c250e48abe7519373d3edf41be62eb5dc45199af2ef</hash>
</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="p = 'The hash of “Hello, world.” is:'">p is wrong.</s:assert>
         <s:assert test="hash = 'f8c3bf62a9aa3e6fc1619c250e48abe7519373d3edf41be62eb5dc45199af2ef'">The hash is wrong.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

14 Sep 2025, Norm Tovey-Walsh
Created test.