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: Modularization



Today I happen to write TREX pattern for RELAX Namespace, and I found
that it was harder than I originally thought.

There is <topLevel> element in RELAX Namespace, in which you can write
<ref> element of RELAX Core. RELAX Namespace also has <namespace>
element, in which you can write <module> element of RELAX Core.

I already have RELAXCore.trex. So my goal was to write
RELAXNamespace.trex that contains all RELAX Namespace declarations and
root.trex that contains patterns that combines those two files.

However, it turns out that I couldn't do that --- because I couldn't
refer to <relaxCore:ref> element. This element is declared by <define>
element.

<grammar>
  <start>
    <ref name="module.label" />
  </start>
  ....
  <define name="ref.label">
    <element name="ref">
      ...
    </element>
  </define>
</grammar>




<element name="topLevel">
   <include href="..." />   <-- No. this refers to module, not ref.
</element>

<element name="topLevel">
   <ref name="ref" href="relaxCore.trex" /> <-- I want something like this
</element>


I can't do the following

<grammar>
  <include href="relaxCore.trex" />
  <include href="relaxNamespace.trex" />
  ...
</grammar>

Because these two have conflicting labels.



The only workaround I found is

<element name="topLevel">
  <grammar>
    <include href="relaxCore.trex" />
    <start combine="replace">
      <ref name="ref.label" />
    </start>
  </grammar>
</element>

Which is quite a lot of typing (at least for me). I believe this also
slows down grammar parsing because validator has to read relaxCore.trex
every time I use <include> pattern.


I think the same problem happens when you try to import <p> from XHTML.

Is this worth raising as an issue?


--
Kohsuke KAWAGUCHI                          +1 650 786 0721
Sun Microsystems                   kohsuke.kawaguchi@eng.sun.com



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


Powered by eList eXpress LLC