This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: dtd
- To: xsl-list at mulberrytech dot com
- Subject: RE: dtd
- From: sara dot mitchell at ps dot ge dot com
- Date: Tue, 15 Aug 2000 18:26:31 -0400
- Reply-To: xsl-list at mulberrytech dot com
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@hotmail.com]
> Sent: Tuesday, August 15, 2000 2:33 PM
> To: xsl-list@mulberrytech.com
> 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