static-expr-context-001

Make sure that static expressions are evaluated with the correct context.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:c="http://www.w3.org/ns/xproc-step"
                xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:ex="http://example.com/xproc"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0"
                exclude-inline-prefixes="#all">
   <p:import href="../step.xpl"/>
   <p:input port="source" sequence="true"/>
   <p:output port="result" primary="true" sequence="true"/>
   
   <ex:step name="test">
      <p:with-option name="test"
                     select="resolve-uri('test.xml')"/>
   </ex:step>
</p:declare-step>

Result

<c:result xmlns:c="http://www.w3.org/ns/xproc-step"
          xmlns:t="http://xproc.org/ns/testsuite/3.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/pipelines/test/test.xml</c:result>

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="c"
         uri="http://www.w3.org/ns/xproc-step"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="c:result">The root isn’t a c:result.</s:assert>
         <s:assert test="ends-with(c:result, 'pipelines/test/test.xml')">Wrong base URI.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

21 May 2025, Norm Tovey-Walsh
Created test. Adapted from a test provided by George Bina. Thank you, George!