RE: specifying attribute choice

"DuCharme, Bob (LNG-CHO)" <[email protected]>
Newsgroups gmane.text.xml.relaxng.general
Message-ID <FEF4858E8AB32D4EAC2CF2A7D85386EBE532C4@lnxdayexch06gb.lexis-nexis.com>
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: [email protected]
[mailto:[email protected]]On Behalf Of G. Ken Holman
Sent: Monday, February 09, 2004 12:25 PM
To: [email protected]
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:[email protected]
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
[email protected]
http://relaxng.org/mailman/listinfo/relaxng-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.