Features: p:ixml

AB p:invisible-xml 001

Tests p:invisible (Example 1 from spec)

Test is expected to pass.

The pipeline

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
   <p:output port="result"/>
   <p:invisible-xml>
      <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>
   </p:invisible-xml>
</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: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

14 Sep 2024, Achim Berndzen
Changed step's name to p:invisible-xml
25 Nov 2023, Achim Berndzen
Initial check in.