According to the latest feature matrix, you'll need to get Saxon EE or EE-T if you want to do this purely with XSLT.  Search on "streaming facilities."
XML documents processed into DOMs are really big.  10, or even 20 times the amount of RAM as the original input document would be reasonable.
If you don't have EE or EE-T, or if you are just looking for a challenge, you can use SAX or one of the push parsers (e.g., XPP) to perform an initial stream of the large document to break it into small chunks. 

Jason Smith
Software Engineer

InfoTrust Group, Inc.

500 Discovery Parkway, Suite 200
Superior, CO 80027


This e-mail and all information included herein do not constitute a legal agreement accorded by INFOTRUST GROUP and its affiliates and subsidiaries.  All legal agreements must be formulated in writing by a legal representative of INFOTRUST GROUP. Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.


From: Mark Rubelmann []
Sent: Saturday, February 25, 2012 8:15 AM
Subject: [saxon] Running out of memory


I'm *hoping* to process some big XML files with XSLT but Saxon is throwing an out of memory exception when the input is only around 350 or 400 mb.  I understand that XSLT needs to have the whole input tree in memory but I don't understand why it's failing with such a [relatively] small input.  Is the loaded tree like 10x bigger than the source XML?  Is there anything I can do to alleviate the problem?  I don't have a really solid requirement yet but I'd feel a lot better if it could handle two gigs.