W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2007

RE: XML Schemas patterns (was: Re: Defining recursive elements?)

From: Michael Kay <mike@saxonica.com>
Date: Fri, 18 May 2007 21:21:59 +0100
To: <noah_mendelsohn@us.ibm.com>, "'Pete Cordell'" <petexmldev@tech-know-ware.com>
Cc: <xmlschema-dev@w3.org>
Message-ID: <018001c7998a$306d8950$6401a8c0@turtle>

> 
> Speaking for myself, I think the more explicit forms such as 
> vehicleName seem to me to be better markup in most cases. 

It's interesting to ask whether vocabularies such as XSLT and XML Schema
follow the rule that a given element name or attribute name has the same
syntax and semantics wherever it appears.

XSLT has a few exceptions, for example xsl:param can appear in three
different places (as a child of xsl:stylesheet, xsl:template, or
xsl:function) and the rules are slightly different in each case, although we
don't actually try to model this in the schema.

XML Schema has more extreme examples, where the content model of
xs:restriction, for example, is very different depending on the context. 

I don't think I would condemn either of these as bad design. In both cases
the similarities outweigh the differences, and from a user perspective the
elements are performing the same function regardless of the context in which
they appear.

Your mention of simplifying XSLT coding suggests a wacky idea: it would be
nice if one could express the validation in terms of rules, for example:

<xs:validation match="xsl:param">
  <xs:complexType>
    ...
  </xs:complexType>
</xs:validation>

<xs:validation match="xsl:template/xsl:param">
  <xs:next-rule/>
  <xs:assert test="not(@required)"/>
</xs:validation>

<xs:validation match="xsl:variable[@select]">
  <xs:complexType>
    a content model ...
  </xs:complexType>
</xs:validation>

<xs:validation match="xsl:variable[not(@select)]">
  <xs:complexType>
    a different content model ...
  </xs:complexType>
</xs:validation>

Seems to unify type derivation, conditional type assignment, global vs local
elements, etc, etc.

Wouldn't it be fun to start again?

Michael Kay
http://www.saxonica.com/
Received on Friday, 18 May 2007 20:22:08 GMT

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