SOLVED! was: Q on incremental processing and count()
Hi! First of all thank you to everyone who gave comments to my qestion. Finally I solved the (performance) problem. 1) I have to write <xsl:value-of select="count(thead/th-c)"/> instead of <xsl:value-of select="count(thead/th-c)"/> This is clear. 2) I have to write <xsl:value-of select="preceding::col-num"/> instead of <xsl:value-of select="../col-num"/> This is not so clear because I have a col-num node before the table and (at least Xalan-J) matches the first element, not the possibly last one. 3) To split tables the "following-sibling" breaks the incremental-processing: <xsl:for-each select="row[position() mod $group-size-col = 1]"> <xsl:apply-templates select=". | following-sibling::row[position() < $group-size-col]"> </xsl:for-each> Instead I have to write: <xsl:for-each select="row[position() mod $group-size-col = 0]"> <xsl:apply-templates select=". | preceding-sibling::row[position() < $group-size-col]"> </xsl:for-each> (and take care of the last rows if count(row) mod $group-size-col != 0) So I have to look backward, not forward. May be this could be made better in Xalan-J. Regards, Michael Tobias Kiesling wrote: > > Jeni Tennison wrote: > > > > >However, from the symptoms that you describe (I'm guessing here - I > >don't know how Xalan works internally), as soon as you do include a > >count() function, Xalan thinks that the stylesheet involves using > >information that is not yet accessible to it, and so reverts to the > >more common processing model where it constructs the whole source tree > >prior to transformation. > > > Independant of the way xalan-j is working, it is not possible for an > incremental processor to output the result of a call to the count > function before the expression inside the count() is completely > evaluated. E.g.: > > <xsl:template match="table"> > <xsl:value-of select="count(thead/th-c)"/> > </xsl:template> > > Here, the result of the call to count() is only available at the end of the table, as it is not known before how much th-c elements will be contained inside thead elements in the table element. > > From a processing point of view the second xpath that Michael proposed (count(thead/th-c)) should do the right job, as the processor does not have to wait until the end of the table element, but just until the end of the first thead element (which should be the only one). > It seems that xalan does not output as soon as would be possible in this case. > > Regards, > Tobias > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format