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

RE: Attribute use depending on another attribute value

From: Michael Kay <mike@saxonica.com>
Date: Thu, 17 May 2007 15:32:11 +0100
To: "'Jan Vosloo'" <jan.vosloo@mxit.com>, <xmlschema-dev@w3.org>
Message-ID: <010801c79890$27f66440$6401a8c0@turtle>
You can't: it's a classic example of a co-occurrence constraint, which XML
Schema 1.0 doesn't support. Wait for 1.1, or use Relax NG or schematron, or
change the attribute name from "type" to "xsi:type".
 
The content model for an element can only depend on the element name and the
value of its xsi:type attribute.
 
Michael Kay
http://www.saxonica.com/


  _____  

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Jan Vosloo
Sent: 17 May 2007 13:06
To: xmlschema-dev@w3.org
Subject: Attribute use depending on another attribute value


  _____  

Click here to view our e-mail legal notice:
http://www.mxit.co.za/pdfs/mxit_legal.pdf or call: +27 21 888 7000

  _____  


Hi, 

I just want to know how I would do the following:

 

<root>

  <test type="1" value="1" display="disp"/>

  <test type="2" value="100" />

</root>

 

I want the 'display' attribute to be available for use depending on what the
value for the 'type' attribute is.

 

How can I do this in a XSD (XML schema)??

 

Thanks you in advance  

 



Jan Vosloo | Developer


Tel: +27 21 888 7000 | Fax: +27 21 883 8123 




 





image001.gif
(image/gif attachment: image001.gif)

Received on Thursday, 17 May 2007 14:32:21 GMT

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