RE: [xsl] XSLT and XML in the same document

Subject: RE: [xsl] XSLT and XML in the same document
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 28 May 2007 00:29:21 +0100
> Of course, my 
> response regarding the cost of the GET request was based on 
> my thought process being distracted long enough to suggest 
> something as silly as including the cost of the GET request 
> for a document that already exists inside of the 
> transformation process.  This, of course, would be correct in 
> cases where you use the document function to access an 
> external document, but incorrect when you use it for 
> introspection of the transformation file.

An XSLT processor might notice at compile time that the stylesheet calls
document('') and might react by keeping a copy of the raw stylesheet entity
around for re-use at run-time. But it's much more likely, I think, that
document('') will be evaluated at run-time and cause a refetch.

(In Saxon, the whitespace nodes, comments and processing instructions in the
stylesheet have been discarded long before the compiler could notice that
there's a call on document('') which requires them to be retained.)

Michael Kay
http://www.saxonica.com/

Current Thread