Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Splitting file into N-sized chunks

From: "Chris Cosentino (ccosenti)" <ccosenti@-----.--->
To: <xsl-list@-----.------------.--->
Date: 8/4/2009 9:24:00 PM
Sorry, I don't know a way of doing it in XSL.

In PHP, you can open a file and start writing to it, then periodically
check the size of the file, being sure to close it before you exceed the
300k limit, then continue writing to a new file. You'd have to keep
things well formed of course as well during this process.

See PHP functions: fopen(), fwrite(), filesize(), etc. http://php.net



> -----Original Message-----
> From: Martynas Jusevicius [mailto:martynas.jusevicius@g...]
> Sent: Tuesday, August 04, 2009 5:10 PM
> To: xsl-list@l...
> Subject: Re: [xsl] Splitting file into N-sized chunks
> 
> 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?
> 
> Yes, my output is ePub. Sony PRS-505 has this limitation -- or maybe
> it's Digital Editions, but it works on the PC. It gives a "Page error"
> if some of the files is too big:
> http://www.mobileread.com/forums/archive/index.php?t-27818.html
> 
> On Tue, Aug 4, 2009 at 10:57 PM, Chris Cosentino
> (ccosenti)<ccosenti@c...> wrote:
> > PHP has a bunch of XML parsers. SimpleXML is a good one:
> > http://us3.php.net/simplexml
> >
> > But, how can you ensure that the XHTML will be valid in 300k chunks?
> > It's possible that an element could contain greater than 300k of
> text.
> > If that's the case, you can't have both valid XHTML and a 300k file.
> >
> > If you know that element <h2> will always contain less than 300k,
> then
> > you can do a redirect-write (or result-document) for that element
and
> > all of the <h2> contained content will be in a separate file.
> >
> > Just curious. What spec are you outputting to? IDPF .epub? I've
never
> > heard of a 300k limit (I've only been working with newer devices
> though)
> >
> > -Chris
> >
> >> -----Original Message-----
> >> From: Martynas Jusevicius [mailto:martynas.jusevicius@g...]
> >> Sent: Tuesday, August 04, 2009 4:44 PM
> >> To: xsl-list@l...
> >> Subject: Re: [xsl] Splitting file into N-sized chunks
> >>
> >> Maybe I didn't make it totally clear... But each of the resulting
> >> files still has to be valid XHTML.
> >> How do you see that achieved in PHP? Maybe with DOM somehow, but
I'm
> >> using XSLT in my workflow so that would be much easier.
> >>
> >> On Tue, Aug 4, 2009 at 10:37 PM, Chris Cosentino
> >> (ccosenti)<ccosenti@c...> wrote:
> >> > Xalan uses <xsl:redirect-write ... >
> >> >
> >> > XSLT 2.0 uses <xsl:result-document ... >
> >> >
> >> > But Marynas, you may have an easier time just using something
like
> >> PHP
> >> > to chunk it out into 300k-sized file.
> 
> --~------------------------------------------------------------------
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail: <mailto:xsl-list-unsubscribe@l...>
> --~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@l...>
--~--



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent