RE: RE: [xsl] Best Practice - collection() function

Subject: RE: RE: [xsl] Best Practice - collection() function
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 7 Jul 2008 12:55:43 +0100
> I am using Saxon 9.06 - 
> 
> Question - I am using keys to provide cross referencing for 
> the index. Since the keys are declared as a child of 
> <xsl:stylesheet>, when I call a collection(), is the key over 
> written or does the key continue to hold all the information 
> in memory?
> 

An index is constructed for a given document the first time the key()
function is used to search that document. The index will be held in memory
so long as both the compiled stylesheet and the document tree are in memory.
In the case of collection(), if you don't use saxon:discard-document(), the
document tree is held in memory until the end of the transformation. In
fact, if I remember correctly, saxon:discard-document() has no effect if
there are indexes for the document in memory [but I need to check that].

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

Current Thread