- From: Henry S. Thompson <ht@inf.ed.ac.uk>
- Date: Wed, 23 Mar 2005 09:14:16 +0000
- To: Eliot Kimber <ekimber@innodata-isogen.com>
- Cc: xml-schema-dev <xmlschema-dev@w3.org>
Same answer as yesterday :-) Substution groups were specifically designed to reconstruct the use of parameter entities for content models as mechanisms for controlled extension. The requirement that the type of a substiution group member be derived from the type of its head imposes the condition you require. Again, as yesterday, if you want to require restriction, then use "final='extension'" on the base type. Quick sketch: Table schema doc: <xs:schema targetNamespace="http://www.example.org/table" xmlns:tc="http://www.example.org/cell"> <xs:import namespace="http://www.example.org/cell"/> . . . <xs:element name="cell"> <xs:complexType> <xs:sequence> <xs:element ref="tc:content"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Table cell schema doc: <xs:schema targetNamespace="http://www.example.org/cell" xmlns="http://www.example.org/cell"> <xs:element name="content" abstract="true" type="contentType"/> <xs:complexType name="contentType"> <xs:sequence> ... </xs:sequence> </xs:complexType> </xs:schema> User schema doc: <xs:schema targetNamespace="http://www.example.org/user" xmlns:tc="http://www.example.org/cell" xmlns:tt="http://www.example.org/table" xmlns="http://www.example.org/user"> <xs:import namespace="http://www.example.org/table"/> <xs:import namespace="http://www.example.org/cell"/> <xs:complexType name="myDisplay"> <xs:sequence> ... <xs:element ref="tt:table"/> ... </xs:sequence> </xs:complexType> <xs:element name="mdContent" type="mdContentType" substitutionGroup="tc:content"/> <xs:complexType name="mdContentType"> <xs:complexContent> <xs:restriction base="tc:contentType"> ... </xs:restriction> </xs:complexContent> </xs:complexType> </xs:schema> Now an instance of the form <tt:table> . . . <tt:cell> <my:mdContent> . . . </my:mdContent> </tt:cell> . . . </tt:table> is schema-valid. Hope this helps, ht -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh Half-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Wednesday, 23 March 2005 09:14:22 UTC