DTDs do not allow you to put rules in that make attributes conditionally required based on the value of other attributes. You can't even do it for elements -- at least not based on the value of an element. The only way you can do conditional requirements is with element content models and different element names. For example: <!ELEMENT func (func1|func2)+> <!ELEMENT func1 EMPTY> <!ATTLIST func1 param0 CDATA #REQUIRED param1 CDATA #REQUIRED> <!ELEMENT func2 EMPTY> <!ATTLIST func2 param2 CDATA #REQUIRED param3 CDATA #REQUIRED> This would allow func to contain one or more func1 or func2 elements in any order. Func1 must have the attributes param0 and param1 and func2 must have the attributes param2 and param3. This is as close as you can get with a DTD to what you asked for. Sara Mitchell > -----Original Message----- > From: xsl list [mailto:xsl_list@xxxxxxxxxxx] > Sent: Tuesday, August 15, 2000 2:33 PM > To: xsl-list@xxxxxxxxxxxxxxxx > Subject: dtd > > > I have an XML witch I need to validate. It contains something like: > <func name="func1" param0="val0" param1="val1"/> > <func name="func2" param2="val2" param3="val3"/> > > In my DTD file I need to write a general rule which indicates that if > @name='func1' then @param0 & @param1 are both REQUIRED, and > if @name='func2' > then @param2 & @param3 are both REQUIRED. > Can I get some help finishing the below dtd please? > > <!ELEMENT func EMPTY> > <!ATTLIST func > name (func1|func2) #REQUIRED > > > ______________________________________________________________ > __________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format