It may be simply that you haven't activated the Saxon-SA functionality by setting the -sa flag.
Or it might be confusion as to whether the element name "data" is lower-case or upper-case?
Michael Kay

From: [] On Behalf Of Anton Khodakivskiy
Sent: 18 December 2007 22:18
Subject: [saxon] Streaming of Large Documents


I tried using SAXON-AS library because someone pointed me that the library is capable of handling large xmls without building full xml tree which consumes A LOT of memory for large files. Currently we need to transform large xml documents - 1 gig+. As I understood SAXON provides a way to grab the data from an external xml using <copy-to /> with read-once="yes" and process it as a stream - i.e. not to use too much memory.

I tried doing this with my large 1 gig xml data file which has the following structure:

  <data />
  <data />

and the xsl stylesheet applied to another xml file with the root tag named "main" (see below)
Transform.exe -s:data.xml -xsl:data.xsl -o:data.csv
eventually threw an out of memory exception.

What am I missing here?

<xsl:stylesheet version="1.0"
  <xsl:output method="text"/>

  <xsl:function name="saxon:customers">
    <xsl:copy-of select="doc(' bigdata.xml')/*/DATA"
                 saxon:read-once="yes" />

  <xsl:template match="main">
    <xsl:apply-templates select="saxon:customers()"/>

  <xsl:template match="data">
    <xsl:value-of select="."/>