Re: [xsl] how to break down a large XML file in small chunks

Subject: Re: [xsl] how to break down a large XML file in small chunks
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sat, 31 Jul 2004 20:05:50 +0100
    <xsl:for-each select="/xml/instances/instance">
      <xsl:if test="(position() &gt;= $firstcount) and (position() &lt;=

That is going through the whole lot each time,throwing most away.
Instead of passing in counters pass in the first node you want

          <xsl:with-param name="firstnode" select="."/>

Then inside the template you cust need


if you are passing numbers, don't do

<xsl:variable name="totalines"><xsl:value-of
select="count(/xml/instances/instance)" /></xsl:variable>


          <xsl:with-param name="firstcount"><xsl:value-of
select="position()" /></xsl:with-param>

as that makes a result tree fragment with a document node containing a
text node with string value the decimal representation of the number
which isn't particularly efficient.

just do
<xsl:variable name="totalines" 
select="count(/xml/instances/instance)" />

          <xsl:with-param name="firstcount" select="position()" />

which makes them numbers.


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread