xsl-list
[Top] [All Lists]

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

2004-07-31 12:05:50

    <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

for-each
select="$firstnode|$firstnode/following-sibling::*[position()&lt;$maxline"/>


if you are passing numbers, don't do

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

or

          <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.

David

________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________


<Prev in Thread] Current Thread [Next in Thread>