- From: Eric Sirois <easirois@rogers.com>
- Date: Wed, 23 Mar 2005 11:20:57 -0500
- To: Eliot Kimber <ekimber@innodata-isogen.com>
- CC: xml-schema-dev <xmlschema-dev@w3.org>
Hi Eliot,
The only thing that XML Schemas will not allow you to specialize in DITA
is substitution/aliasing an element in a specific content model using
extension/restriction. Domains elements (globally substituted elements)
can use substitutionGroups only if the derived content model does not
have attempt to substitute/alias an element specific to that new content
model. Even with the new subsumption algorithm I don't belive that this
will
be possible in XML Schema 1.1 spec.
If I remember correctly (someone, please correct me if I'm wrong), even
if the specialized element content model is based on its parent becasue
the specialized element is not base type - validation will fail. Even
if the base is extended with the new element first (Intemediate content
model) and the derived type is based on intermediate model there is no
way to guarentee validity based on the permutated tree of valid
elements. Right?
One hack I did in the past was to create a global abstarct version of
specialized element and then a local element of the same name to the
content model.
Some parser implementation did not check whether or not the element was
global or local and validated the schema with no issues...but that did
not last to long.
<xs:element name="prereq" type="prereq.class" abstarct="true"
substitutionGroup="section">
In the example below there is no way to substitute/alias ( in the
current WXS spec and the WXS 1.1 spec either) prereq, context, result,
and postreq for section in taskbody only (taskbody is a derivative
body). This is one of the I had to remove any use of the XML Schema
inheritance model from the DITA schemas.
Does someone now of a way substitute a global element in a specific
context while making use of WXS extension/restriction model where the
new element has the same content model as the base element?
Kind regards,
Eric
Example
Base
<xs:element name="body" type="body.class">
<xs:annotation>
<xs:documentation>The <<keyword>body</keyword>> element is the
container for the
main content of a <<keyword>topic</keyword>>.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="body.class">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="body.cnt"/>
<xs:group ref="section"/>
<xs:group ref="example"/>
</xs:choice>
<xs:attribute name="outputclass" type="xs:string"/>
<xs:attributeGroup ref="id-atts"/>
<xs:attribute name="translate" type="yesno-att.class"/>
<xs:attribute ref="xml:lang"/>
<xs:attributeGroup ref="global-atts"/>
<xs:attribute ref="class" default="- topic/body "/>
</xs:complexType>
Would be derivative
<xs:complexType name="taskbody.class">
<xs:sequence>
<xs:group ref="prereq" minOccurs="0"/>
<xs:group ref="context" minOccurs="0"/>
<xs:choice minOccurs="0" maxOccurs="1">
<xs:group ref="steps" />
<xs:group ref="steps-unordered" />
</xs:choice>
<xs:group ref="result" minOccurs="0"/>
<xs:group ref="example" minOccurs="0"/>
<xs:group ref="postreq" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="outputclass" type="xs:string"/>
<xs:attributeGroup ref="id-atts"/>
<xs:attribute name="translate" type="yesno-att.class"/>
<xs:attribute ref="xml:lang"/>
<xs:attributeGroup ref="global-atts"/>
<xs:attribute ref="class" default="- topic/body task/taskbody "/>
</xs:complexType>
Received on Wednesday, 23 March 2005 16:21:37 UTC