railroad-002
Tests that cx:railroad returns the right properties.
Test is expected to pass.
The pipeline
<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
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/railroad.xpl"/>
<p:output port="result" sequence="true"/>
<cx:railroad>
<p:with-input>
<p:inline content-type="text/plain">
S ::= a b
</p:inline>
</p:with-input>
</cx:railroad>
<p:identity>
<p:with-input select="p:document-properties(.)"/>
</p:identity>
<p:cast-content-type content-type="application/xml"/>
</p:declare-step>
Result
<map xmlns="http://www.w3.org/2005/xpath-functions"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<string key="content-type">image/svg+xml</string>
<string key="cx:nonterminal">S</string>
<string key="cx:ebnf"><div xmlns="http://www.w3.org/1999/xhtml" class="ebnf"><code>
<div><a href="#S" title="S" shape="rect">S</a> ::= <a href="#a" title="a" shape="rect">a</a> <a href="#b" title="b" shape="rect">b</a></div></code></div></string>
<string key="base-uri">file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/tests/rr-002.xml</string>
</map>
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:ns prefix="fn"
uri="http://www.w3.org/2005/xpath-functions"/>
<s:pattern>
<s:rule context="/">
<s:assert test="fn:map">Result isn’t a map.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/fn:map">
<s:assert test="fn:string[@key='cx:ebnf']">No EBNF property.</s:assert>
<s:assert test="fn:string[@key='cx:nonterminal'] = 'S'">No nonterminal property.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 30 Jan 2025, Norm Tovey-Walsh
- Created test.