[relaxng-user] RNC Question | Element Dependency on Enumerated Attribute

Bruce D'Arcus bdarcus at fastmail.fm
Thu Mar 10 07:54:53 ICT 2005


On Mar 10, 2005, at 1:17 AM, Oli Young wrote:

> what i'd like to be able to do is make another element pattern 
> dependant on the selected 'type', so if 'text' is selected, 'length' 
> is required, if 'select' is selected, the 'options' attribute is 
> required.

How about something like:

Field = Text | Select

Text = element field { attribute type {"text"}, attribute length { text 
} }
Select = element field { attribute type {"select"}, Options }
Options = element options { Option* }
Option = element option {
			attribute value,
			text
		}

Bruce



More information about the relaxng-user mailing list