railroad-001

Tests that cx:railroad runs.

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:declare-step>

Result

<svg xmlns="http://www.w3.org/2000/svg"
     xmlns:t="http://xproc.org/ns/testsuite/3.0" width="135" height="37">
   <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"/>
   <a xmlns:xlink="http://www.w3.org/1999/xlink"
      xlink:href="#a" xlink:title="a" shape="rect">
      <rect x="31" y="3" width="28" height="32"/>
      <rect x="29" y="1" width="28" height="32"
            class="nonterminal"/>
      <text class="nonterminal" x="39" y="21">a</text>
   </a>
   <a xmlns:xlink="http://www.w3.org/1999/xlink"
      xlink:href="#b" xlink:title="b" shape="rect">
      <rect x="79" y="3" width="28" height="32"/>
      <rect x="77" y="1" width="28" height="32"
            class="nonterminal"/>
      <text class="nonterminal" x="87" y="21">b</text>
   </a>
   <path class="line"
         d="m17 17 h2 m0 0 h10 m28 0 h10 m0 0 h10 m28 0 h10 m3 0 h-3"/>
   <polygon points="125 17 133 13 133 21"/>
   <polygon points="125 17 117 13 117 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

30 Jan 2025, Norm Tovey-Walsh
Created test.