xsl-list
[Top] [All Lists]

Re: DTD question

2003-01-24 14:52:00
Hubert Holtz wrote:
Hy,

I know that this is not a real XSL question, but it's connected with this topic 
:-)

I have an element adress with several elements in it(prename, name, fax, 
phone,street...)
and I want that these elements only may appear once, but the order is not 
important, and that prename and name have to appear, the rest
don't have to but if they appear then just once of course.

How do I tell the dtd to do this?

Without SGML's "&" (and) operator, XML requires you to explicitly state each possible combination of elements. This is, in theory, always possible, but it usually results in such a large OR group of OR groups that it's not done. Easier to just state the rule in the DTD's documentation and enforce it in a separate validation application (which might be your main data processing application or something like Schematron).

For example, given this desired constraint: (foo & bar & baz) you can declare this content model:

((foo, bar, baz) |
 (foo, baz, bar) |
 (bar, foo, baz) |
 (bar, baz, foo) |
 (baz, foo, bar) |
 (baz, bar, foo))

Cheers,

Eliot
--
W. Eliot Kimber, eliot(_at_)isogen(_dot_)com
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>