RE: Best Practice - collection() function
> I use the collection function to generate a single FO file > for PDF output. > There are several times I use the collection function to > output different information for the FO (table of contents, > index). Everything works as expected, but it becomes highly > inefficient when I use the collection function on the same > folder 3 times. > > For example, I would use the collection(file:///c:/folder) 3 > times in my > xslt: > > * to build a TOC > * to build a Index > * Build chapters in a book. > > Because I have to build my FO with page sequences, I end up > calling the same 800 xml files 3 times. Is there a way to do > this more efficiently? The implementation of the collection() function is likely to vary from one product to another - one can't generalize about it's caching behaviour without knowing which product you are talking about. If you want to maximize the chances that the result of the collection() function is held in memory, so that multiple calls with the same URI don't re-read the individual files, then it would be best to put the result in a variable. I think that Saxon will re-read the directory contents on each call, but will cache the individual documents. Michael Kay http://www.saxonica.com/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format