[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Using Saxon 8.5 and collection() to process a dir

Subject: RE: Using Saxon 8.5 and collection() to process a directory of XML files
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 4 Aug 2005 16:23:56 +0100
collection discard
Yes, if the collection is held in a global variable then it's likely that
all the documents will be locked down.

If it's in a local variable the situation is more complex: if Saxon can
detect that you are doing a single iteration over the contents of the
variable, then it won't actually hold the whole sequence in memory, but in
other cases it will.

Doing <for-each select="collection($in)/discard-document(.)"> or
<apply-templates select="collection($in)/discard-document(.)"> is safest.

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

> -----Original Message-----
> From: David Carlisle [mailto:davidc@xxxxxxxxx] 
> Sent: 04 August 2005 15:57
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Using Saxon 8.5 and collection() to 
> process a directory of XML files
> 
> 
> 
> > You can call saxon:discard-document() to make a document 
> available for
> > garbage collection when there are no outstanding references to it.
> 
> ah, thanks.
> 
> So does that  mean  that one shoudn't make a global variable
> 
>   <xsl:variable name="collection" select="collection(...
> 
>   <xsl:template name="main">
>     <xsl:for-each select="$collection/saxon:discard-document(.)" ...
> 
> 
> as that will force you to keep the document around forever in 
> case I go 
> $collection[66]/a/b/c at some strange point? Or can your stylesheet
> analysis detect that the variable is only used in a top level loop?
> 
> 
> Should I instead go
> 
> 
>   <xsl:template name="main">
>   <xsl:for-each select="collection( ...)/saxon:discard-document(.)"
> 
> 
> 
> so that outside the loop the node is not accessible (without reparsing
> the document)
> 
> David
> 
> ______________________________________________________________
> __________
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ______________________________________________________________
> __________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.