[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: 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
break text file
    <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
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.