W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2001

element substitutiongroups (fwd)

From: <forge@neonics.com>
Date: Wed, 28 Mar 2001 19:46:55 +0000 (UTC)
To: xmlschema-dev@w3.org
Message-ID: <Pine.LNX.4.21.0103281945520.531-100000@fire>

I've searched the web and found that 'RELAX' is capable of:

- permit a single tag to have different content depending upon the context
  in which it is used; and 
- permit a tag to have different content depending upon the value of that
  tag's attributes 

Is this (going to be) in the XML Schema specification ?

---------- Forwarded message ----------
Date: Wed, 28 Mar 2001 19:19:43 +0000 (UTC)
From: Forge <forge@neonics.com>
To: xmlschema-dev@w3.org
Subject: element substitutiongroups
Resent-Date: Wed, 28 Mar 2001 12:12:05 -0500 (EST)
Resent-From: xmlschema-dev@w3.org

Hi there,

Normally the substitutiongroups look at the element name.

Is it also possible to make it look at some attribute name?

I have an element as such:

<status report-type="xxx">
  <!-- some other elements, depending on the "xxx' above -->

I have made the following schema:

  <xsd:element name="status-report" type="statusReport" abstract="true"/>

  <!-- 'base class' -->
  <xsd:complexType name="statusReport">
      <xsd:element name="options" type="options" minOccurs="0"/>
    <xsd:attribute name="report-type" type="xsd:string" use="required"/>

  <!-- instance for report-type="a" -->
  <xsd:element name="status" substitutionGroup="status-report">
        <xsd:restriction base="statusReport">

          <!-- add the 'payment-clusters' element -->
            <xsd:element name="payment-clusters" type="paymentClusters"

          <!-- fix the attribute to 'a' -->
          <xsd:attribute name="report-type">
              <xsd:restriction base="xsd:string">
                <xsd:enumeration value="a"/>


and something like that for "b". The only difference between the two is
the attribute's value and there is another element (not payment-clusters
but something else).

XMLSpy gives me the (correct) error that there are multiple declarations
of element 'status'.

Can this be done? Maybe with "xsd:choice", if so, how? I'd like
to keep the 'subclassing' in since I don't want to keep copying
everything :)

Thanks for your efforts!


	Kenney Westerhof
Received on Wednesday, 28 March 2001 12:38:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:51 UTC