W3C home > Mailing lists > Public > www-xml-xinclude-comments@w3.org > September 2004

Re: FW: how does XInclude mix with XML Schema? XSLT?

From: Norman Walsh <Norman.Walsh@Sun.COM>
Date: Wed, 08 Sep 2004 14:03:53 -0400
To: Dan Connolly <connolly@w3.org>, www-xml-xinclude-comments@w3.org
Cc: public-xml-core-wg@w3.org
Message-id: <87pt4wd4dy.fsf@nwalsh.com>
Dan,

I don't believe there are any tests of XInclude used with XML Schema
or XSLT processors. I don't know of any processors that (directly)
support XInclude in schema documents or stylesheet documents.
(Indirect support through pipeline languages such as sxpipe is
certainly possible.)

Schemas can certainly be written that validate the occurence of
xi:include elements in input documents (assuming that the input
document was not subject to XInclude processing, of course).
Similarly, stylesheets can be written that will transform xi:include
elements or produce them in the transformed result.

An XInclude in a schema or stylesheet document, if the document was
subject to XInclude processing before the schema or stylesheet
processor encountered it, would behave exactly like an external parsed
entity.

  <xsl:stylesheet xmlns:xsl="...">
    <xsl:output method="xml"/>
    <xi:include xmlns:xi="..." href="someDocument.xsl"/>
  </xsl:stylesheet>

is effectively the same as

  <!DOCTYPE xsl:stylesheet [
  <!ENTITY someDocument SYSTEM "someDocument.xsl">
  ]>
  <xsl:stylesheet xmlns:xsl="...">
    <xsl:output method="xml"/>
    &someDocument;
  </xsl:stylesheet>

This is distinct from the xsl:include element (or the xsd:include
element) which performs additional, application-specific semantic
processing *in addition to* performing a kind of textual inclusion.

Had XInclude existed when XML Schema or XSLT were under development, I
think it *could* have been used instead, but it cannot be used instead
now. In particular:

  - including one stylesheet "style.xsl" in another with XInclude
    would likely result in a xsl:stylesheet element as a child of the
    "including" xsl:stylesheet which would be an error.

  - including one stylesheet "style.xsl/*/*" in another with XInclude
    would not inform the including stylesheet of any attribute values
    that might have been set on the included stylesheet's root element.
    That could produce quite different semantics than xsl:include.

I hope this helps clarify the situation.

                                        Be seeing you,
                                          norm

-- 
Norman.Walsh@Sun.COM / XML Standards Architect / Sun Microsystems, Inc.
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.

Received on Wednesday, 8 September 2004 18:04:14 GMT

This archive was generated by hypermail 2.2.0 + w3c-0.30 : Thursday, 9 June 2005 12:16:10 GMT