This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 19144 - support for required attribute name aliases (or attribute/attributeGroup choice)
Summary: support for required attribute name aliases (or attribute/attributeGroup choice)
Status: NEW
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: Future
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: David Ezell
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-29 19:54 UTC by adam.gladki
Modified: 2012-09-30 21:05 UTC (History)
2 users (show)

See Also:


Attachments

Description adam.gladki 2012-09-29 19:54:40 UTC
support for required attribute name aliases and/or attribute/attributeGroup choice

In 1.1 you can achieve element name aliases:
 - substitution groups
 - <xs:choice>
But none of this works on attributes where you want required attribute name to have an alias:
 <ELEMENT name="Some Element">
 <ELEMENT caption="Some Element">
where "name" or "caption" should be specified. Another case is when you want to have alternative attributeGroups for an element with required ones included. 

Motivation:
In my opinion this may by non rare case when you create schema for existing inconsistent XML documents ensuring backward compatibility or other motivations that bring substitution groups to elements. Anyway in my opinion similar capabilities should be available for elements and attributes.
Comment 1 Michael Kay 2012-09-30 21:05:33 UTC
This can be achieved in XSD 1.1 using assertions or using conditional type assignment. 

Using assertions: assert test="count((@name, @caption) eq 1)"

Using CTA:

alternative test="exists(@caption) != exists(@name)" type="..."
alternative (other) type="xs:error

There are no plans to produce a new version of XSD in the near future, so I think you will have to use one of these mechanisms for the foreseeable future.