[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Choose predefined xs:attributeGroup - Help needed

From: <lawrence.michel@post.ch>
Date: Mon, 7 Aug 2006 11:53:08 +0200
Message-ID: <9F070A0CEA0F624593CF61492059AA490A8E49@hmsx23.pnet.ch>
To: <xmlschema-dev@w3.org>
how to choose attributegroup choice

Hi all,

I'm actually trying to design an XML-Schema that should be universally
used within form creation (Xforms, XSL-t processing, and XML validation
check). I'm actually designing one that should be representing a graph
of all possible valid attribute combination within an element. Below a
simple example:

Here a basic Product element in XML:

<Product pr_name="ONE" pr_Info="A"/>

Now, according to some business rules, let's say that all products named
"ONE" should have their pr_Info attribute set to either A or B, and all
products named "TWO" should have their pr_Info attribute set to either C
or D.

A possible solution is to design an XML-schema proposing a choice of all
Product element representing all possible combination according to their
pr_Name.

I'm looking to have to design it with the use of attribute groups, such
as (pseudo-code below):

attributeGroupA is:
	Attribute name="pr_Info" value=restriction on either A or B
attributeGroupB is:
	Attribute name="pr_Info" value=restriction on either C or D

Element product
	start choice
		choice 1: attribute pr_Name = ONE and attributeGroupA
		choice 2: attribute pr_Name = TWO and attributeGroupB
	end choice
/Element

Which will correspond to validate XML data such as:

<Product pr_name="ONE" pr_Info="A"/>
<Product pr_name="TWO" pr_Info="C"/>
<Product pr_name="ONE" pr_Info="B"/>
(...)

Any idea would be greatful

Best regards ;-)

Lawrence Michel
Received on Monday, 7 August 2006 18:11:03 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.