railroad-007
Tests that cx:railroad automatically converts grammar formats.
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 notation="ixml">
<p:with-input>
<p:inline content-type="text/plain">
S = "a" | "b" .
</p:inline>
</p:with-input>
</cx:railroad>
</p:declare-step>
Result
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:t="http://xproc.org/ns/testsuite/3.0" width="127" height="81">
<defs>
<style type="text/css" xml:space="preserve">
@namespace "http://www.w3.org/2000/svg";
.line {fill: none; stroke: #332900; stroke-width: 1;}
.bold-line {stroke: #141000; shape-rendering: crispEdges; stroke-width: 2;}
.thin-line {stroke: #1F1800; shape-rendering: crispEdges}
.filled {fill: #332900; stroke: none;}
text.terminal {font-family: Verdana, Sans-serif;
font-size: 12px;
fill: #141000;
font-weight: bold;
}
text.nonterminal {font-family: Verdana, Sans-serif;
font-size: 12px;
fill: #1A1400;
font-weight: normal;
}
text.regexp {font-family: Verdana, Sans-serif;
font-size: 12px;
fill: #1F1800;
font-weight: normal;
}
rect, circle, polygon {fill: #332900; stroke: #332900;}
rect.terminal {fill: #ffdb4d; stroke: #332900; stroke-width: 1;}
rect.nonterminal {fill: #FFEC9E; stroke: #332900; stroke-width: 1;}
rect.text {fill: none; stroke: none;}
polygon.regexp {fill: #FFF4C7; stroke: #332900; stroke-width: 1;}
</style>
</defs>
<polygon points="9 17 1 13 1 21"/>
<polygon points="17 17 9 13 9 21"/>
<rect x="51" y="3" width="28" height="32" rx="10"/>
<rect x="49" y="1" width="28" height="32" class="terminal"
rx="10"/>
<text class="terminal" x="59" y="21">a</text>
<rect x="51" y="47" width="28" height="32" rx="10"/>
<rect x="49" y="45" width="28" height="32" class="terminal"
rx="10"/>
<text class="terminal" x="59" y="65">b</text>
<path class="line"
d="m17 17 h2 m20 0 h10 m28 0 h10 m-68 0 h20 m48 0 h20 m-88 0 q10 0 10 10 m68 0 q0 -10 10 -10 m-78 10 v24 m68 0 v-24 m-68 24 q0 10 10 10 m48 0 q10 0 10 -10 m-58 10 h10 m28 0 h10 m23 -44 h-3"/>
<polygon points="117 17 125 13 125 21"/>
<polygon points="117 17 109 13 109 21"/>
</svg>
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="svg:svg">The root is wrong.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 24 Feb 2025, Norm Tovey-Walsh
- Created test.