[xsl] Measuring the (byte) size of an XSL output chain on the fly

Subject: [xsl] Measuring the (byte) size of an XSL output chain on the fly
From: Neil Smith <neil@xxxxxxxxxxxxxxx>
Date: Wed, 23 Jul 2003 22:06:31 +0100
Hi all -

Run into an interesting problem which I hope somebody might have a few ideas about. I don't remember anything like this being discussed or documented. I'll be checking the wapforum and related sites in the meantime.

I am planning to transform some existing content into WML (wireless markup) from a sequential XML source using XSLT (rather than DOM). The WML browser targets have limitations on the size of content which can be delivered, about 1500-1800 bytes uncompressed.

I would like to retain the simplicity of doing this transformation using an XSL stylesheet. However, I am not aware of any functions which can determine the output result size, in bytes, of a set of nodes. This is not a question about counting the input bytes, rather I want to determine if I can count the number of bytes in a result set as it is transformed.

I envisage using a simple for-each loop, and checking before each iteration if the result size exceeds the limiting value I put into a param in the stylesheet. If the result size is within a certain range of the limit, I would close the WML 'deck' and exit the stylesheet.

So - has anybody got a good idea how I could do this ?

Thanks in advance -
Regards - Neil Smith.

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread