Re: [xsl] Xinclude with Xalan 2.4

Subject: Re: [xsl] Xinclude with Xalan 2.4
From: Elliotte Rusty Harold <elharo@xxxxxxxxxxxxxxx>
Date: Fri, 25 Apr 2003 22:35:57 -0400
At 9:12 PM -0400 4/25/03, Gregory Propf wrote:

Ok, I looked at your link. But I see it like this - a stylesheet is applied to an XML document. If the document declares, in effect "I contain this other document here.xml" then it seems that it would be implied that anyone wishing to apply a stylesheet would, of necessity, have to first parse the xml and do the include of here.xml. Thus, I would think that XInclude should always precede any application of a stylesheet. I'm just thinking of it like a mathematical process. If y = sin(x) and someone tells me that x = 2a + b then it seems that you better redefine y as y = sin (2a + b).


No, XSLT processing and XInclude processing are not distributive (I think that's the right word). You might want to apply them in that order, but don't assume I do. For instance, I have written XSLT stylesheets that remap the URLs in XInclude href attributes to point to different servers. That doesn't work if the XIncludes are automatically resolved.


A conforming XSLT processor knows *nothing* about XInclude. As far as it knows, an xinclude:include element is just an element with the local name include and the URI http://www.w3.org/2001/xinclude; and it treats it as it would treat any other element. That is, it looks for a matching template rule and applies it or if one is not found it uses the default template rule. Good XSLT processors do not resolve XIncludes. They may operate on documents in which the includes have been resolved, or they may operate on documents in which the includes have not been resolved. However, an XSLT processor is not an XInclude processor.
--


+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@xxxxxxxxxxxxxxx | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|           Processing XML with Java (Addison-Wesley, 2002)          |
|              http://www.cafeconleche.org/books/xmljava             |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+

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


Current Thread