RE: [xsl] Including a document

Subject: RE: [xsl] Including a document
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 27 Jun 2001 17:12:13 +0100
>   The reason I am not interested in calling document() twice,
> is because
> every time document is called, "B.xml" is read, parsed etc.
> and suppose
> if B.xml is a very large file, doing it twice seems a waste
> of resources.

The processor shouldn't do that: if you call document() twice with the same
URI, it's obliged to return the same root node each time (so
count(document('A.xml')|document('A.xml')) is guaranteed to be 1).

But it's not a bad idea to put the call on document in a global variable
anyway:

<xsl:variable name="B.xml" select="document('B.xml')"/>

and then you can replace your calls on document('B.xml') with a reference to
$B.xml

Mike Kay
Software AG


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


Current Thread