trang-001
Tests DTD to RNG
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/trang.xpl"/>
<p:output port="result" sequence="true"/>
<cx:trang output-base-uri="http://example.com/schemas/"
result-format="rng">
<p:with-input>
<p:inline content-type="application/xml-dtd">
<!ELEMENT doc (p+)>
<!ELEMENT p (#PCDATA)*>
</p:inline>
</p:with-input>
</cx:trang>
</p:declare-step>
Result
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<define name="doc">
<element name="doc">
<ref name="attlist.doc"/>
<oneOrMore>
<ref name="p"/>
</oneOrMore>
</element>
</define>
<define name="attlist.doc" combine="interleave">
<empty/>
</define>
<define name="p">
<element name="p">
<ref name="attlist.p"/>
<zeroOrMore>
<text/>
</zeroOrMore>
</element>
</define>
<define name="attlist.p" combine="interleave">
<empty/>
</define>
<start>
<choice>
<ref name="doc"/>
</choice>
</start>
</grammar>
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="rng"
uri="http://relaxng.org/ns/structure/1.0"/>
<s:pattern>
<s:rule context="/">
<s:assert test="rng:grammar">The root is wrong.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 23 Mar 2025, Norm Tovey-Walsh
- Created test.