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: Parameterized patterns


Should patterns be able to take parameters?

Here's how this might work.

A define element would be able to start with one or more param
elements.  The param element have a required name attribute giving the
name of the parameter.  The content is a pattern specifing the default
value.  If there is no content, the parameter is required.

A ref element would be able to contain one or more param elements.  As
in define the param element would have a required name attribute giving
the name of the parameter. The content is a pattern.

Suppose for example we wanted to require that the root element of a TREX
pattern had a version attribute.

<start>
  <ref name="pattern">
    <param name="version">
      <attribute name="version"/>
    </param>
  </ref>
</start>
      
<define name="pattern">
  <param name="version">
    <empty/>
  </param>
  <choice>
    <element name="choice">
      <ref name="version"/>
      <oneOrMore>
        <ref name="pattern"/>
      </oneOrMore>
    </element>
    ...
  </choice>
</define?

This would also be useful for doing things that in SGML were done with
inclusions.

The main disadvantage is that this adds significant complexity.

I also haven't yet thought through the implications of this for the
restrictions on recursion.

Perhaps this is a version 2 feature.

James



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


Powered by eList eXpress LLC