Re: [xsl] Q on incremental processing and count()

Subject: Re: [xsl] Q on incremental processing and count()
From: Enke Michael <Michael.Enke@xxxxxxxxxxxxxxxxxx>
Date: Tue, 19 Feb 2002 10:00:28 +0100
Hi Joerg,
of course I don't count all the 200 entries ;-)
I count the number of table header columns (<th-c>)
(provided before the rows) and divide them
by the value of col-num (provided before <table> starts)
to decide if a row of data has to be broken into
two (or more) rows of html and therefor not show
20 rows of data in html but only 10 or less.

Here comes the code snippet. Look at the lines with comments:
These lines break the incremental processing.
If I change it to fixed values:
-> <xsl:variable name="count-th-c" select="10"/>
-> <xsl:variable name="col-num" select="10"/>
-> <xsl:variable name="col-num" select="20"/>
then incremental processing works.

 <xsl:template match="table">
  <hr/>
  <xsl:variable name="group-size" select="20"/>
  <xsl:variable name="count-th-c">
   <!-- next line breaks incremental-processing -->
   <xsl:value-of select="count(thead/th-c)"/>
  </xsl:variable>
  <xsl:variable name="col-num">
   <xsl:choose>
    <!-- next line breaks incremental-processing -->
    <xsl:when test="../col-num">
     <!-- next line breaks incremental-processing -->
     <xsl:value-of select="../col-num"/>
    </xsl:when>
    <xsl:otherwise>
     <xsl:value-of select="$count-th-c"/>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:variable name="group-size-col" select="round($group-size div ceiling($count-th-c div $col-num))"/>
  <center>
   <xsl:apply-templates>
    <xsl:with-param name="col-num" select="$col-num"/>
    <xsl:with-param name="group-size-col" select="$group-size-col"/>
   </xsl:apply-templates>
  </center>
  <hr/>
 </xsl:template>

Once more: What I mean with incremental processing:
Incremental processing is if the data coming out of the xslt processor
as soon as the rows are processed (and there is no reference to later data).

Incremental processing broken: The data comes out of the xslt processor
after reading the whole xml. This is my point.

Regards,
Michael


Joerg Heinicke wrote:
> 
> > My problem is the execution speed.
> > I have a large table (200 entries) and split them into small tables (per
> > table 20 entries, every subtable with the same table header).
> > My problem is: The browser gets the result if all 200 entries are
> processed in
> > the memory! Arrrrgggg...
> > But I expected to see the tables as they come out of the database.
> > Because for investigating I made it so, that every item needs half a
> second
> > to be generated.
> > I expected to see the first sub table after 20*0.5 seconds, the second
> table
> > after 2*20*0.5 seconds and so on.
> > But actually I see all tables not before 200*0.5 seconds :-(
> >
> > If I remove the count() and ...following-sibling... I lost my
> > table structure but I can see how the values come out as they
> > were produced.
> 
> I can't imagine that it's because of complex table structure or HTML
> rendering. I think it's a problem in the XSL. If you are counting for all
> the 200 entries all preceding nodes, it will waste much time. Or are you
> using '//' anywhere? Post the important part of the XSL, maybe we can help
> you.
> 
> Regards,
> 
> Joerg
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread