Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: "Houghton,Andrew" <houghtoa@----.--->
To: <xsl-list@-----.------------.--->
Date: 8/4/2009 9:30:00 PM
> 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?

If you are using Saxon you can use the saxon:string-to-utf8(), but that
assumes that your XHTML output encoding is going to be UTF-8.  If your
XHMTL output encoding is going to be UTF-16, then you probably can use
the XSLT string-length() function.

If you are not using Saxon, but using XSLT 2, you can use the XSLT
string-to-codepoints() function and calculate the UTF-8 length based on
the codepoints.  I did that for a project back a while ago that wasn't
using Saxon.

Everytime you output a tag, whitespace or text you will have to keep
track of its length.  Since you will always have a static XHTML header
and footer that wraps your content, you might pre-calculate that length
rather than calculate it on the fly.


Hope this helps, Andy.



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