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

Re: Splitting file into N-sized chunks

Subject: Re: Splitting file into N-sized chunks
From: Martynas Jusevicius <martynas.jusevicius@xxxxxxxxx>
Date: Wed, 5 Aug 2009 00:04:07 +0200
Re:  Splitting file into N-sized chunks
Thanks a lot for the input, I'll try it out.

On Tue, Aug 4, 2009 at 11:49 PM, Michael Kay<mike@xxxxxxxxxxxx> wrote:
>> Well it doesn't have to be exactly 300K, could be less of
>> course :) But XHTML needs to be valid.
>> So any ideas on (roughly) calculating the size? Number of
>> characters perhaps?
>
> A lot depends on how far you want to go. If you're prepared to split it at a
> boundary between children of the body element, it's not too hard. If you
> need to cater for deeply-nested tables, with the possibility of having 500K
> of text in a single table cell, then it's much harder.
>
> For the first case, it's a fairly simple exercise in sibling recursion:
> write a template that processes the first child of <body>, and then calls
> itself to process the next child (following-sibling::*[1]) and so on,
> passing the accumulated text size as a parameter, and exiting when this
> reaches some threshold.
>
> (I say simple, but I use this as an exercise on XSLT courses and some people
> find it very difficult, if they're not used to recursive list processing).
>
> Regards,
>
> Michael Kay
> http://www.saxonica.com/
> http://twitter.com/michaelhkay

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.