OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

relax-ng message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: exclusions


At the moment to model an exclusion in TREX, you have to use concur. 
Here's an example from the XHTML DTD:

<define name="a">
  <element name="a">
    <ref name="a.attlist"/>
    <concur>
      <ref name="Inline.model"/>
      <ref name="a.concur"/>
    </concur>
  </element>
</define>

<define name="a.concur">
  <grammar>
    <start name="not.excluded">
      <zeroOrMore>
        <choice>
          <element>
	    <not>
	      <name>a</name>
	    </not>
            <zeroOrMore>
              <attribute>
	        <anyName/>
	      </attribute>
            </zeroOrMore>
	    <ref name="not.excluded"/>
          </element>
          <anyString/>
	</choice>
      </zeroOrMore>
    </start>
  </grammar>
</define>

While this is kind of cool, it is not easy to write, nor is it obvious
to a reader what the intent is. It also suffers from all the
disadvantages that are entailed by use of concur (as I outlined in my
previous message).

One alternative would be to have an element that supported exclusions
directly:

<define name="a">
  <element name="a">
    <ref name="a.attlist"/>
    <excludeElement name="a">
      <ref name="Inline.model"/>
    </excludeElement>
  </element>
</define>

Like the "element" and "attribute" elements, the "excludeElement"
element would have either a "name" attribute or a child element
specifying a name class.  The semantics of

<excludeElement> nc p </excludePattern>

would be that it matches any sequence that matches p and that does not
contain at any depth an element whose name matches nc.  This has a nice
simple semantics, is not hard to implement and can be "transformed out".

<excludeElement> nc <choice> p1 p2 </choice> </excludeElement>
=>
<choice>
  <excludeElement> nc p1 </excludeElement>
  <excludeElement> nc p2 </excludeElement>
</choice>

<excludeElement> nc1 <element> nc2 p </element> </excludeElement>
=>
<element> <difference> nc2 nc1 </difference> p </element>

etc.

Are exclusions important enough to be worth this?  My feeling is that
they are important enough for documents (eg footnotes don't nest) to
justify this.

James



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC