Thanks for the enquiry. Nice to see streaming being used. This is the same document I used for my demonstration of streaming at Balisage 2010.

I can't immediately see why it's producing wrong results. I'll investigate, but it may take a day or two.

Michael Kay
Saxonica



On 24/01/2012 10:13, Denis DEBARBIEUX wrote:
Hi all,

I am trying to evaluate a XSLT sheet with SAXON in streaming mode. I have trouble.

My message is organise in 3 parts:
A. Create the XSLT sheet
B. Evaluate it on a small document: here, I have no problem.
C. Evaluate it on a huge document: here, I have trouble.

A. Create the XSLT sheet
  The goal of my sheet is to check two very simple properties and to output messages when they fail.

The properties are evaluate over node labelled by Polygon . Then the two assertions are:
1. this polygon has an attribute id.
2. this polygon  has a child head.

<xsl:transform
    xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='3.0' 
    xmlns:saxon='http://saxon.sf.net/'>
    <xsl:mode streamable="yes" /> 
    <xsl:template name="main" match="/">
        <property>
            <!-- get all the polygons of a MultiSurface specified by its id -->
            <xsl:variable name="context" select="saxon:stream(descendant::*:MultiSurface[attribute::*:id='UUID_643df4fe-4a26-4d86-b245-1b5fd0049191_Ur']//Polygon)"/>           
            <!-- this polygon has an attribute id.  --->
            <test assert="id">               
                <xsl:if test="$context[not(attribute::*:id)]" >
                    <noid>
                    A polygon  must have an id value                                       
                    </noid>
                </xsl:if>
            </test>
            <!--this polygon  has a child head.-->
            <test assert="head">
                <xsl:if test="$context[not(child::*:head)]" >
                    <nohead>
                    A polygon must have a 'head' for the title.
                    <diagnostic>
                        <xsl:variable name="polygonId" select="$context/attribute::*:id"/>
                        No title (head element) for polygon <xsl:value-of select="$polygonId"/>
                    </diagnostic>                                                        
                    </nohead>

                </xsl:if>
            </test>   
        </property> 
    </xsl:template> 
</xsl:transform>

B. Evaluate it on a small document
Here is the input document
<doc>
    <MultiSurface id="UUID_643df4fe-4a26-4d86-b245-1b5fd0049191_Ur">
         <surfaceMember>
             <Polygon id="Polygon1">
             </Polygon>
         </surfaceMember>
     </MultiSurface>
</doc>

As the polygon has an attribute id but it has not child head. The output is
<?xml version="1.0" encoding="UTF-8"?>
<property xmlns:saxon="http://saxon.sf.net/">
    <test assert="id"/>
      <test assert="head">
         
<nohead>
            A polygon must have a 'head' for the title.
            <diagnostic>
                No title (head element) for polygon Polygon1
            </diagnostic>
        </nohead>
    </test>

</property>


C. Evaluate it on a huge document (44Gbytes). It can be downloaded here: ftp://ftp.fpk.tu-berlin.de/pub/Kolbe/22x22xTestEttenheim_inkl_4xLod4Buildings.zip

Here is a part of the huge document:
<CityModel >
        ...
       <MultiSurface id="UUID_643df4fe-4a26-4d86-b245-1b5fd0049191_Ur">
          <surfaceMember>
            <Polygon id="UUID_a5557a09-a5e6-434f-b329-4356dbccd529_Ur">
             ...

As in the previous example, the polygon has an attribute id but has not child head. Indeed, the label 'head' does not occur in the document
ddebarbieux@ddebarbieux-PC ~
$ grep head  /cygdrive/c/huge_document/22x22xTestEttenheim_inkl_4xLod4Buildings.xml

ddebarbieux@ddebarbieux-PC ~

The output is the following. No message is displayed about the missing head.
<?xml version="1.0" encoding="UTF-8"?>
<property xmlns:saxon="http://saxon.sf.net/">
    <test assert="id"/>
    <test assert="head"/>
</property>

Denis
-- 
Denis Debarbieux
Engineer at INRIA


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help