[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Multiple rules in RELAX (was Re: And the DTD says...)
- From: Murata Makoto <mura034@attglobal.net>
- To: xml-dev@xml.org
- Date: Wed, 10 Jan 2001 22:24:28 +0900
-- Caroline Clewlow wrote:
> Is this something that RELAX takes care of with it's <elementRule role=""
> label="">
> whereby two element rules can have the same role with a different label
> depending on how they constrain their child elements ?
RELAX Core allows the same label to be defined more than once.
In DTDs, the first one wins. In programming languages, the
last one wins. In RELAX Core, all of them win.
Here is an example of this feature. Two modules in XHTML Basic
define the parameter entity "head.content".
In xhtml-struct-1.mod
<!ENTITY % head.content
"( %HeadOpts.mix;, %title.qname;, %HeadOpts.mix; )"
>
In xhtml-base-1.mod
<!ENTITY % head.content
"( %HeadOpts.mix;,
( ( %title.qname;, %HeadOpts.mix;, ( %base.qname;, %HeadOpts.mix; )? )
| ( %base.qname;, %HeadOpts.mix;, ( %title.qname;, %HeadOpts.mix; ))))"
>
When xhtml-base-1.mod is used, the dcl in xhtml-struct-1.mod is
overshadowed.
My rewrite of xhtml-struct-1.mod has a hedgeRule for head.content,
and my rewrite of xhtml-base-1.mod also has another hedgeRule.
But the first one is never overshadowed.
As a result, the hedgeRule in the rewrite of xhtml-base-1.mod
can be simplified. It is equivalent to the following.
<!ENTITY % head.content
"( %HeadOpts.mix;,
( ( %title.qname;, %HeadOpts.mix;, %base.qname;)
| ( %base.qname;, %HeadOpts.mix;, %title.qname))
%HeadOpts.mix;)"
>
Although this feature is useful for modularization, I do not
claim that we can get rid of features of <redefine>. I
hope to incorporate <redefine> feeatures in the upcoming
ISO TR (not DTR) for RELAX Core.
Cheers,
Makoto