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

Re: Schema restriction between attributes

Subject: Re: Schema restriction between attributes
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 31 May 2003 06:53:16 +0100
schema restriction attribute
>>>>> "Eran" == Eran Hammer-Lahav <xalan@xxxxxxxxx> writes:

    Eran> Is there a way in a schema to specify restrictions on one
    Eran> attribute if another has a certain value? Here is an
    Eran> example:

    Eran> <?xml version="1.0" ?> <xs:schema id="x" targetNamespace="x"
    Eran> xmlns:x="x" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    Eran> version="1.0"> <xs:element name="structure">
    Eran> <xs:complexType> <xs:sequence> <xs:element name="field"
    Eran> minOccurs="0" maxOccurs="unbounded"> <xs:complexType>
    Eran> <xs:attribute name="name" type="xs:string" use="required" />
    Eran> <xs:attribute name="type" type="omm:memberType"
    Eran> use="required" /> <xs:attribute name="typeName"
    Eran> type="xs:string" use="optional" /> </xs:complexType>
    Eran> </xs:element> </xs:sequence> <xs:attribute name="class"
    Eran> type="xs:string" use="required" /> <xs:attribute
    Eran> name="dbTable" type="xs:string" use="required" />
    Eran> </xs:complexType> </xs:element> </xs:schema>

    Eran> I want that if structure/@type = 'enum', structure/@typeName
    Eran> will not be empty. Is there a way to achieve this in the
    Eran> schema? I know I can do this in the xslt script, by check
    Eran> each value and using the <xsl:message> message to end
    Eran> execution, but I would like to have the schema control this.

You can do this by embedding Schematron rules within the schema.


See: http://www.topologi.com/public/Schtrn_XSD/Paper.html
-- 
Colin Paul Adams
Preston Lancashire

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
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-2013 All Rights Reserved.