oasis-open / dita-rng-converter

OASIS TC Open Repository: The DITA RNG Converter provides cross-platform tools for generating DITA-conforming DTD- and XSD-format versions of RELAX NG DITA grammars: document type shells, vocabulary modules, and constraint modules. It makes it as easy as possible to develop and maintain DITA grammars by allowing use of RELAX NG syntax.
https://github.com/oasis-open/dita-rng-converter
Apache License 2.0
7 stars 10 forks source link

Handle rng:notAllowed in constraint modules #17

Open drmacro opened 6 years ago

drmacro commented 6 years ago

The 1.3 spec shows this example for defining a constraint:

<div>
<a:documentation>MODULE INCLUSIONS</a:documentation>
<include href="topicMod.rng"/>
<include href="hazardstatementDomainMod.rng"/>
<include href="highlightDomainMod.rng">
<ditaarch:domainsContribution
>(topic hi-d-noUnderline-c)</ditaarch:domainsContribution>
<define name="u">
<notAllowed></notAllowed>
</define>
</include>
<include href="indexingDomainMod.rng"/>
<include href="utilitiesDomainMod.rng"/>
</div>

With the intent being that the notAllows for the u element removes it from any content models it's part of.

Need to implement this processing so that notAllowed patterns are removed from any context where they are referenced.

This requires ensuring that the resulting parameter entity or model group is valid. For example, if all members of a group are removed, the group itself must be removed. If a parameter entity ends up being empty, then references to the parameter entity must be removed in contexts where a reference too an empty parameter entity is not allowed (i.e., content models).

lief-erickson commented 4 months ago

@drmacro, I've been attempting to use this project. It works to convert RNG to DTD & XSD for basic shells and topic specializations, although I did have to workaround a $resultUri issue in rng2ditadtd.xsl. What's the status of the constraint support?

When I attempt to convert /test/topicmod-constraint, I get this error:

     [java] Type error at char 22 in xsl:variable/@select on line 110 column 7 of rng2catalogs.xsl:
     [java]   XTTE0570: Required item type of value of variable $rngDocs is document-node(); supplied
     [java]   value has item type xs:base64Binary
     [java]   at xsl:call-template name="generateCatalog" (file:/D:/dita-rng-converter/xsl/rng2catalogs/rng2catalogs.xsl#123)