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: Re: combine


>In other words, deriving from Address changes what is allowed by a reference
>to Address.

This is true, but can be easily mimicked as below.  Basically, we only have 
to introduce another named pattern.

<grammar>

 <start>
 <element name="dmy">
 <element name="uk">
   <ref name="UKAddress"/>
 </element>
 <element name="us">
   <ref name="USAddress"/>
 </element>
 </element>
 </start>

<define name="AddressForReference">
  <ref name="Address">
</define>

<define name="AddressForReference" combine="choice">
  <ref name="USAddress">
</define>


<define name="AddressForReference" combine="choice">
  <ref name="UKAddress">
</define>

 <define name="Address">
    <element name="name"><anyString/></element>
    <element name="street"><anyString/></element>
    <element name="city"><anyString/></element>
 </define>

  <define name="USAddress">
   <ref name="Address"/>
   <element name="state"><anyString/></element>
   <element name="zip"><anyString/></element>
  </define>

  <define name="UKAddress">
   <ref name="Address"/>
   <element name="postcode"><anyString/></element>
   <attribute name="exportCode"><anyString/></attribute>
  </define>

 </grammar>

>allow a postCode. Derivation by extension in XML Schema supports this.  In
>RELAX NG, combine="group" provides similar functionality.

You have overshadowed the original definition of "Address"; in other words,  postCode 
has become mandatory in your example.  I think that this is very different from 
what people would expect.

><grammar>
>
><include href="invoice.rng"/>
>
><define name="Address" combine="group">
>  <element name="postCode">
>    <text/>
>  </element>
></define>
>
></grammar>

----
MURATA Makoto  mura034@attglobal.net


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


Powered by eList eXpress LLC