[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DTD Entity
- From: Rick Jelliffe <email@example.com>
- To: firstname.lastname@example.org, email@example.com
- Date: Sun, 11 Mar 2001 10:59:39 +0800
From: firstname.lastname@example.org <email@example.com>
>Richard Knapp scripsit:
>> We are working on DTD with the following requirement:
>> - Base element consists of Child elements First, Second, Third, and
>> - First must appear under Base.
>> - Second, Third, and Fourth may appear zero or one time.
>> - Order is not important for elements Second, Third, and Fourth.
In Schematron, you can express that like this
<assert test="count(*)=count(First) + count(Second) + count(Third) +
>Base element consists of Child elements First, Second, Third, and
>First must appear under Base.</assert>
<assert test="count(Second) < 2 and count(Third) < 2 and
count(Fourth) < 2"
>Second, Third, and Fourth may appear zero or one time</assert>
>Order is not important for elements Second, Third, and Fourth.</assert>
Note that there is a one-to-one correspondence between the original text
the assertions' statements. This is common with Schematron schemas.
(However, it is an interesting question whether, just because it is easy to
write Schematron schemas from informal/partial specs, such specs are also
easier to read by third parties.
Of course, there are consiseness issues too, when thinking of readability,
however that really is a notation issue of XML versus DTD syntax versus some
Note also that the process of finding a test to implements the statement
light on the statement, allowing it to be refined: in this case that "First
under Base" means that First is a required element that is no repeating (it
In the Schematron schema, there is a clear separation from the requirements
statements) and the implementation (the test attributes).
(For anyone interested, Schematron is a free software language and toolkit
for programmers at http://www.ascc.net/xml/schematron )