Yes, it's simple. Sorry it took so long to get to the bottom of it.

The expression

saxon:stream(doc(session.extractor/@file))/student/stint/@*

should be

saxon:stream(doc(session.extractor/@file)/student/stint/@*)

That is, the argument to saxon:stream should be a path expression of the form doc()/a/b/c/d

The clue comes when you use -explain: this tells you whether streaming is being used or not, and hints at why.

Michael Kay
Saxonica


On 14 May 2013, at 08:04, David Rudel wrote:

Michael,
I did overlook one thing earlier. I had earlier indicated that the timing output was similar for both versions of the script ("both" here referring to the [saxon:stream()] version on the one hand and the [saxon:read-once="yes"] version on the other).

This is incorrect. I had forgotten there was a different set of files my script was also referencing. The trees built from these files threw dust in my eyes when I was looking at the -t output. The [saxon:stream()] version was creating trees for both sets of files, but the [saxon:read-once="yes"] version was only making trees for the second set of files (as desired).

So, it looks like the [saxon:read-once="yes"] version is correctly streaming the file, but the [saxon:stream()] version is not.

I have made a very small reproducible case with anonymized source files. This script does not reference the second set of files. It is a very simple script that takes a set of records of the form

   <student>
      <session.extractor file="file:/C:/Users/Drudel/Desktop/SVN_Testing/f0001.xml"/>
   </student>

Then opens (using saxon:stream) the file to pull some information from it and load it into a variable:


    <xsl:variable name="stint.info">
        <stint>
            <xsl:copy-of select="saxon:stream(doc(session.extractor/@file))/student/stint/@*"/>
        </stint>
    </xsl:variable>

Then writes a record based on that information.

<student stint.start="{concat($stint.info/stint/@start.date,'T00:00:00')}"/>

I am attaching a zip file that includes the files. Included is the timing output when run on Saxon 9.3.0.5 via oxYgen.

The script is FHBv2_debug2.xsl
This should be run on repro_tree.xml
repro_tree.xml contains references to 4 files: f0001.xml, f0002.xml, f0003.xml, f0004.xml, these files are the ones that should be streamed.

(These files are all just copies of the same tiny file.)



On Tue, May 14, 2013 at 8:45 AM, David Rudel <fwqhgads@gmail.com> wrote:
Michael,
I did overlook one thing earlier. I had earlier indicated that the timing output was similar for both versions of the script ("both" here referring to the [saxon:stream()] version on the one hand and the [saxon:read-once="yes"] version on the other).

This is incorrect. I had forgotten there was a different set of files my script was also referencing. The trees built from these files threw dust in my eyes when I was looking at the -t output. The [saxon:stream()] version was creating trees for both sets of files, but the [saxon:read-once="yes"] version was only making trees for the second set of files (as desired).

So, it looks like the [saxon:read-once="yes"] version is correctly streaming the file, but the [saxon:stream()] version is not.

I have made a very small reproducible case with anonymized source files. This script does not reference the second set of files. It is a very simple script that takes a set of records of the form

   <student>
      <session.extractor file="file:/C:/Users/Drudel/Desktop/SVN_Testing/f0001.xml"/>
   </student>

Then opens (using saxon:stream) the file to pull some information from it and load it into a variable:


    <xsl:variable name="stint.info">
        <stint>
            <xsl:copy-of select="saxon:stream(doc(session.extractor/@file))/student/stint/@*"/>
        </stint>
    </xsl:variable>

Then writes a record based on that information.

<student stint.start="{concat($stint.info/stint/@start.date,'T00:00:00')}"/>


I am attaching a zip file that includes the files. Included is the timing output when run on Saxon 9.3.0.5 via oxYgen.

The script is FHBv2_debug2.xsl
This should be run on repro_tree.xml
repro_tree.xml contains references to 4 files: f0001.xml, f0002.xml, f0003.xml, f0004.xml, these files are the ones that should be streamed.








On Mon, May 13, 2013 at 9:33 PM, Michael Kay <mike@saxonica.com> wrote:

On 13 May 2013, at 18:49, David Rudel wrote:

> Sure, Michael, I'll get right on that.
> Just a quick question: there isn't anything really simple and basic I'm missing about this, right?

Yes, I think there probably is, and I'm hoping that when I see a more complete picture of what you are doing I will immediately spot the obvious mistake.

> I don't need to put "Streamable = 'yes'" on anything or otherwise utilize "modes" on templates to use the saxon:stream() command, right?
>
> My understanding is that streaming templates are a separate beast from the use of saxon:read-once and saxon:stream. I just want to make sure of that before wasting your time.

Yes, that understanding is correct.

Michael Kay
Saxonica




------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help



--

"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.



--

"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.
<SaxonStreamRepro.zip>------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help