[relaxng-user] Difference between externalRef and include

James Clark jjc at jclark.com
Fri Dec 5 08:03:53 ICT 2003

On Sun, 2003-11-30 at 05:41, David Tolpin wrote:
> The RELAX NG Specification says that the resource behind URI passed as argument to 'externalRef'
> must much the syntax for pattern, while one passed to 'include' must match the syntax for grammar.

This is correct.  It wouldn't be coherent for include to reference a

> The Relax NG Compact Syntax says that both should reference a grammar in the compact syntax.

Section 2 in the Compact Syntax spec includes the sentence

"The value of an anyURILiteral specified with include or external is a
URI reference to a grammar in the compact syntax."

The point this sentence is trying to make is that the thing referenced
by include or external is in the compact syntax rather that the XML
syntax.  (At one stage trang's predecessor translated each file
individually and left file names unaltered.)  It's not trying to say
that what's referenced is always a grammar rather than a pattern.  I can
see now that the sentence is at best misleading and needs an errata.

Note that in the Compact Syntax spec, Appendix A contains the full,
rigorous specification and the other sections are an informal summary. 
When in doubt, consult Appendix A.

> Further on, jing parses contents of an external file passed to externalRef as a grammar,
> but refuses to accept the same file if passed to include.

A file referenced by externalRef is parsed as a pattern, which will be
unacceptable to include, unless it is also a grammar.  Are you saying
Jing is inconsistent with the RELAX NG spec?


More information about the relaxng-user mailing list