W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2007

[Bug 5297] Drop restriction of assertions to down-pointing XPaths?

From: <bugzilla@wiggum.w3.org>
Date: Fri, 30 Nov 2007 10:27:10 +0000
To: www-xml-schema-comments@w3.org
Message-Id: <E1Iy35S-0001H9-Tk@wiggum.w3.org>


------- Comment #2 from mike@saxonica.com  2007-11-30 10:27 -------
I think it's a good principle that an element is valid or invalid based only on
its content, and not on its context in some larger document. XSLT and XQuery
rely on this principle, allowing you to assemble a document bottom-up, knowing
that if a component is valid in itself, then it will still be valid when
inserted into a larger tree. We do have one exception to this, the
document-level constraints on ID/IDREF, but that's manageable.

In the use case cited, if we argued that an input element can never exist
without a containing form, then it would be impossible for XSLT to construct
the form. There are definitely contexts where it's quite reasonable for an
input element to exist without the containing form, for example in the results
of a query performing introspection on the form. This truly is a constraint on
valid HTML elements, not a constraint on input elements.

There is one usability issue with constraints like count(.//input) =
count(.//form//input) - it's very hard to produce an error message that
identifies the offending input element. If users can be persuaded to write such
constraints in the form

every $i in .//input satisfies ($i intersect .//form//input)

then it might be possible to do better. At present our restricted XPath subset
discourages this. 
Received on Friday, 30 November 2007 10:27:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:50:07 UTC