static-expr-context-001

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

Test static-expr-context-001.xml 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" 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"/>
   <!-- test -->
   <ex:step name="test">
      <p:with-option name="test" select="resolve-uri('test.xml')"/>
   </ex:step>
</p:declare-step>

Schematron validation

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" 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!