Subject: RE: [xsl] Re: Measuring the (byte) size of an XSL output chain on the fly From: "Koes, Derrick" <Derrick.Koes@xxxxxxxxxxxxxxxx> Date: Wed, 23 Jul 2003 17:26:15 -0400 |
This counts characters which would be good for a single byte character encoding. -----Original Message----- From: Dimitre Novatchev [mailto:dnovatchev@xxxxxxxxx] Sent: Wednesday, July 23, 2003 5:24 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Re: Measuring the (byte) size of an XSL output chain on the fly This transformation: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="/"> <xsl:variable name="vResult"> <xsl:apply-templates/> </xsl:variable> Length of output is: <xsl:text/> <xsl:value-of select="concat(string-length($vResult), '
')"/> <xsl:if test="string-length($vResult) <= 1800"> <xsl:copy-of select="$vResult"/> </xsl:if> </xsl:template> </xsl:stylesheet> when applied on this source.xml: <nums> <num>01</num> <num>02</num> <num>03</num> <num>04</num> <num>05</num> <num>06</num> <num>07</num> <num>08</num> <num>09</num> <num>10</num> </nums> produces the wanted result: Length of output is: 51 <nums> <num>01</num> <num>02</num> <num>03</num> <num>04</num> <num>05</num> <num>06</num> <num>07</num> <num>08</num> <num>09</num> <num>10</num> </nums> ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL "Neil Smith" <neil@xxxxxxxxxxxxxxx> wrote in message news:5.2.0.9.0.20030723215624.00ac32a8@xxxxxxxxxxxxxxxxxxxx > 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 > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list This electronic transmission is strictly confidential to Smith & Nephew and intended solely for the addressee. It may contain information which is covered by legal, professional or other privilege. If you are not the intended addressee, or someone authorized by the intended addressee to receive transmissions on behalf of the addressee, you must not retain, disclose in any form, copy or take any action in reliance on this transmission. If you have received this transmission in error, please notify the sender as soon as possible and destroy this message. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Re: Measuring the (byte) , Dimitre Novatchev | Thread | RE: [xsl] Re: How to show distinct , Poort, J. |
[xsl] Re: Measuring the (byte) size, Dimitre Novatchev | Date | Re: [xsl] Re: Measuring the (byte) , Eric van der Vlist |
Month |