W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2004

RE: Problem with types derived from mixed complex types

From: Michael Kay <mhk@mhk.me.uk>
Date: Fri, 4 Jun 2004 17:58:30 +0100
To: "'Tait E Larson'" <telarson@us.ibm.com>, <xmlschema-dev@w3.org>
Message-Id: <20040604165914.736C9A1879@frink.w3.org>

This is how it's done in the schema for XSLT 2.0:

<xs:complexType name="versioned-element-type" mixed="true">
  <xs:complexContent>
    <xs:extension base="xsl:generic-element-type">    
      <xs:attribute name="version" type="xs:decimal" use="optional"/>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:complexType name="text-element-base-type">
  <xs:simpleContent>
    <xs:restriction base="xsl:versioned-element-type">
      <xs:simpleType>
        <xs:restriction base="xs:string"/>
      </xs:simpleType>
      <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:restriction>
  </xs:simpleContent>
</xs:complexType>

<xs:element name="text" substitutionGroup="xsl:instruction">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xsl:text-element-base-type">
        <xs:attribute name="disable-output-escaping" type="xsl:yes-or-no"
default="no"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element> 

This is doing what the post you refer to says isn't allowed: deriving
simpleContent by restriction from complexContent. It seems to work!

Michael Kay


> 
> 
> In regards to restricting a complex type so that it only 
> contains text, has
> this problem been resolved?  The original post can be found here:
> 
> http://lists.w3.org/Archives/Public/xmlschema-dev/2003Jan/0028.html
> 
> I looked through the errata at:
> 
> http://www.w3.org/2001/05/xmlschema-rec-comments.html.
> 
> I could not find any discussion of the problem.
> 
> Thanks,
> 
> Tait
> 
> 
> 
Received on Friday, 4 June 2004 12:59:14 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:44 GMT