[relaxng-user] specifying attribute choice

DuCharme, Bob (LNG-CHO) bob.ducharme at lexisnexis.com
Mon Feb 9 14:25:55 ICT 2004


Thanks Ken! That worked. Maybe I was misunderstanding the problem of the
original one, though, because the syntax of the solution still seems to tell
me that multiple x attributes are OK in the element. 

Bob


-----Original Message-----
From: relaxng-user-bounces at relaxng.org
[mailto:relaxng-user-bounces at relaxng.org]On Behalf Of G. Ken Holman
Sent: Monday, February 09, 2004 12:25 PM
To: relaxng-user at relaxng.org
Subject: Re: [relaxng-user] specifying attribute choice


At 2004-02-09 12:00 -0500, DuCharme, Bob (LNG-CHO) wrote:
>I'm trying to figure out how I can specify that an element must have at
>least one of a certain set of attributes and may have the others as well.
If
>the attributes are called x, y, and z, I could say something like ((x & y?
>&z?) | (x? & y & z?)| (x? & y? & z)), but it doesn't scale up well.
>Something like
>
>   attlist.a =
>     (attribute x {text},
>      attribute y {text},
>      attribute z {text})+

Close, Bob ... just change "," to "|".

...................... Ken

Y:\samp>type bob.rnc
start = element doc { attlist.a }

attlist.a =
     (attribute x {text} |
      attribute y {text} |
      attribute z {text})+


Y:\samp>type bob.xml
<doc/>
Y:\samp>jing -c bob.rnc bob.xml
Y:\samp\bob.xml:1: error: unfinished element

Y:\samp>type bob2.xml
<doc y="hello"/>
Y:\samp>jing -c bob.rnc bob2.xml

Y:\samp>type bob3.xml
<doc y="hello" x="goodbye"/>
Y:\samp>jing -c bob.rnc bob3.xml

Y:\samp>


--
Public courses: upcoming world tour of hands-on XSL training events
Each week:    Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO
Washington, DC: 2004-03-15            San Francisco, CA: 2004-03-22
Hong Kong: 2004-05-17    Germany: 2004-05-24    England: 2004-06-07
World-wide on-site corporate, government & user group XML training!

G. Ken Holman                  mailto:gkholman at CraneSoftwrights.com
Crane Softwrights Ltd.           http://www.CraneSoftwrights.com/r/
Box 266, Kars, Ontario CANADA K0A-2E0     +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness   http://www.CraneSoftwrights.com/r/bc

_______________________________________________
relaxng-user mailing list
relaxng-user at relaxng.org
http://relaxng.org/mailman/listinfo/relaxng-user


More information about the relaxng-user mailing list