Features: p:ixml

markup-blitz-001

Ported the standard ab-i-xml-001 test to use cx:markup-blitz.

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" version="3.0">
   <p:import href="https://xmlcalabash.com/ext/library/markup-blitz.xpl"/>
   <p:output port="result"/>
   <cx:markup-blitz>
      <p:with-input port="grammar">
         <p:empty/>
      </p:with-input>
      <p:with-input port="source">
         <p:inline content-type="text/plain">
                  date: s?, day, s, month, (s, year)? .
                  -s: -" "+ .
                  day: digit, digit? .
                  -digit: "0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9".
                  month: "January"; "February"; "March"; "April";
                  "May"; "June"; "July"; "August";
                  "September"; "October"; "November"; "December".
                  year: (digit, digit)?, digit, digit .
               </p:inline>
      </p:with-input>
   </cx:markup-blitz>
</p:declare-step>

Result

<ixml xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <rule name="date">
      <alt>
         <option>
            <nonterminal name="s"/>
         </option>
         <nonterminal name="day"/>
         <nonterminal name="s"/>
         <nonterminal name="month"/>
         <option>
            <alts>
               <alt>
                  <nonterminal name="s"/>
                  <nonterminal name="year"/>
               </alt>
            </alts>
         </option>
      </alt>
   </rule>
   <rule mark="-" name="s">
      <alt>
         <repeat1>
            <literal tmark="-" string=" "/>
         </repeat1>
      </alt>
   </rule>
   <rule name="day">
      <alt>
         <nonterminal name="digit"/>
         <option>
            <nonterminal name="digit"/>
         </option>
      </alt>
   </rule>
   <rule mark="-" name="digit">
      <alt>
         <literal string="0"/>
      </alt>
      <alt>
         <literal string="1"/>
      </alt>
      <alt>
         <literal string="2"/>
      </alt>
      <alt>
         <literal string="3"/>
      </alt>
      <alt>
         <literal string="4"/>
      </alt>
      <alt>
         <literal string="5"/>
      </alt>
      <alt>
         <literal string="6"/>
      </alt>
      <alt>
         <literal string="7"/>
      </alt>
      <alt>
         <literal string="8"/>
      </alt>
      <alt>
         <literal string="9"/>
      </alt>
   </rule>
   <rule name="month">
      <alt>
         <literal string="January"/>
      </alt>
      <alt>
         <literal string="February"/>
      </alt>
      <alt>
         <literal string="March"/>
      </alt>
      <alt>
         <literal string="April"/>
      </alt>
      <alt>
         <literal string="May"/>
      </alt>
      <alt>
         <literal string="June"/>
      </alt>
      <alt>
         <literal string="July"/>
      </alt>
      <alt>
         <literal string="August"/>
      </alt>
      <alt>
         <literal string="September"/>
      </alt>
      <alt>
         <literal string="October"/>
      </alt>
      <alt>
         <literal string="November"/>
      </alt>
      <alt>
         <literal string="December"/>
      </alt>
   </rule>
   <rule name="year">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="digit"/>
                  <nonterminal name="digit"/>
               </alt>
            </alts>
         </option>
         <nonterminal name="digit"/>
         <nonterminal name="digit"/>
      </alt>
   </rule>
</ixml>

Schematron checks

<s:schema xmlns="http://www.w3.org/1999/xhtml"
          xmlns:cx="http://xmlcalabash.com/ns/extensions"
          xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:t="http://xproc.org/ns/testsuite/3.0"
          queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="ixml">The root element is not 'ixml'.</s:assert>
         <s:assert test="ixml/rule">The root element does not have a 'rule' child.</s:assert>
         <s:assert test="ixml/rule/@name='date'">The 'rule' element does not have an attribute 'name' with value 'date'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

22 Feb 2025, Norm Tovey-Walsh
Created test.