[Bug 7198] can inheritable attributes appear, on elements with simple types

http://www.w3.org/Bugs/Public/show_bug.cgi?id=7198


Michael Kay <mike@saxonica.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mike@saxonica.com




--- Comment #2 from Michael Kay <mike@saxonica.com>  2009-08-03 17:52:07 ---
Here's a use case: a document has an outermost element of <product-data> with a
version attribute whose value is version="1" or version="2". Deep within the
document, element size has two alternative types: if version="1" the type is
string with a pattern facet [0-9]+(in|cm); if version="2" the type is a complex
type with simple content allowing instances such as <size units="cm">5</size>.

To make this work with conditional type assignment, you make
product-data/@version an inherited attribute, and you make the type of the size
element have two alternatives, one being a simple type, the other a complex
type with simple content. You can refer to @version as an inherited attribute
in the test expression of the xs:alternative elements, even though the version
attribute can't actually appear on the size element.

Now, it might have been clearer to the reader if the XPath expression had been
../@version rather than ./@version. We're trying to have our cake and eat it
here: to disallow context-dependent validation while also allowing it in a
limited number of cases where we think it makes sense. There might be better
ways we could have done it, but we were trying to compromise between these two
objectives and that's what we did.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 3 August 2009 17:52:17 UTC