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

RE: String conversion problem when string is large

Subject: RE: String conversion problem when string is large
From: "Bulgrien, Kevin" <Kevin.Bulgrien@xxxxxxxxxxxx>
Date: Tue, 20 Mar 2012 16:04:58 -0500
RE:  String conversion problem when string is large
-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: Tuesday, March 20, 2012 3:50 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  String conversion problem when string is large

Try changing this:

           <xsl:with-param name="HexData">
             <xsl:value-of select="substring-after($HexData, ',')" />
           </xsl:with-param>

to this:

           <xsl:with-param name="HexData" select="substring-after($HexData,
',')" />

Passing the parameter as a string will be MUCH more efficient than passing it
as a TinyTree.

Even better, though probably not necessary, would be to pass the original
unchanged string plus an offset.

Michael Kay
Saxonica

-----

That resulted in success.

$java -Xms1g -Xmx2g -jar ~/bin/saxon9he.jar -t -s:develop/idiffout.xml
-xsl:idiffout.xsl -o:idiffout.csv

Saxon-HE 9.4.0.3J from Saxonica
Java version 1.6.0_22
Warning: at xsl:stylesheet on line 2 column 80 of idiffout.xsl:
  Running an XSLT 1 stylesheet with an XSLT 2 processor
Stylesheet compilation time: 438 milliseconds
Processing
file:/home/kbulgrien/cvs/r8000/update/IDiff2DUA/develop/idiffout.xml
Using parser
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Building tree for
file:/home/kbulgrien/cvs/r8000/update/IDiff2DUA/develop/idiffout.xml using
class net.sf.saxon.tree.tiny.TinyBuilder
Tree built in 156 milliseconds
Tree size: 6616 nodes, 570130 characters, 10303 attributes
Execution time: 844ms
Memory used: 110727304
NamePool contents: 33 entries in 33 chains. 6 URIs

$ awk 'BEGIN { FS="," } /AppCompatCache/ { print NF-9  " vs " $9 }'
idiffout.csv
53392 vs 53392
53392 vs 53392

I have much to learn.  Those two things look identical to me.

Thank-you very much.

---
Kevin Bulgrien

On 20/03/2012 19:58, Bulgrien, Kevin wrote:
> -----Original Message-----
> From: Bulgrien, Kevin [mailto:Kevin.Bulgrien@xxxxxxxxxxxx]
> Sent: Tuesday, March 20, 2012 2:06 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE:  String conversion problem when string is large
>
> -----Original Message-----
> From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
> Sent: Tuesday, March 20, 2012 1:39 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  String conversion problem when string is large
>
> The simplest solution is to just find a different XSLT processor, one that
implements tail recursion optimization. Saxon, for example.
>
> You could rewrite the code either to use XSLT 2.0 string handling or to use
divide-and-conquer recursion, but unless there is something that ties you to
your current XSLT processor there is no need to change the code.
>
> Michael Kay
> Saxonica
> -----
>
> I didn't expect that answer... I guess that's encouraging.
>
> I have tried the Java version of SaxonB 9-1-0-8j, but some links appeared to
be broken (or else something on my company proxy choked) on the SourceForge
relative to the most recent .zip of SaxonHE9-4 so I didn't try it before
today.  Since your reply, I tried some creative Googling and turned up a
download link that works.  I'll give try SaxonHE9-4-0-3J.zip a try.
>
> -----
>
> Well, I tried SaxonHE9-4 and got:
>
> $ java -Xms1g -Xmx2g -jar ~/bin/saxon9he.jar -t
> -s:develop/idiffout.xml -xsl:idiffout.xsl -o:idiffout.csv Saxon-HE
> 9.4.0.3J from Saxonica Java version 1.6.0_22
> Warning: at xsl:stylesheet on line 2 column 80 of idiffout.xsl:
>    Running an XSLT 1 stylesheet with an XSLT 2 processor Stylesheet
> compilation time: 437 milliseconds Processing
> file:/home/kbulgrien/cvs/r8000/update/IDiff2DUA/develop/idiffout.xml
> Using parser
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
> Building tree for
> file:/home/kbulgrien/cvs/r8000/update/IDiff2DUA/develop/idiffout.xml
> using class net.sf.saxon.tree.tiny.TinyBuilder
> Tree built in 162 milliseconds
> Tree size: 6616 nodes, 570130 characters, 10303 attributes Exception
> in thread "main" java.lang.OutOfMemoryError: Java heap space
>          at
net.sf.saxon.tree.util.FastStringBuffer.condense(FastStringBuffer.java:485)
>          at
net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:308)
>          at
net.sf.saxon.expr.parser.ExpressionTool.evaluate(ExpressionTool.java:320)
>          at
net.sf.saxon.expr.instruct.GeneralVariable.getSelectValue(GeneralVariable.jav
a:529)
>          at
net.sf.saxon.expr.instruct.Instruction.assembleParams(Instruction.java:187)
>          at
net.sf.saxon.expr.instruct.CallTemplate.processLeavingTail(CallTemplate.java:
369)
>          at
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:615)
>          at
net.sf.saxon.expr.instruct.Choose.processLeavingTail(Choose.java:794)
>          at
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:615)
>          at net.sf.saxon.expr.instruct.Template.expand(Template.java:231)
>          at
net.sf.saxon.expr.instruct.CallTemplate$CallTemplatePackage.processLeavingTai
l(CallTemplate.java:526)
>          at
net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:239)
>          at
net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.j
ava:199)
>          at
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:615)
>          at
net.sf.saxon.expr.instruct.Choose.processLeavingTail(Choose.java:794)
>          at
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:615)
>          at
net.sf.saxon.expr.instruct.Template.applyLeavingTail(Template.java:212)
>          at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:1034)
>          at
net.sf.saxon.expr.instruct.ApplyTemplates$ApplyTemplatesPackage.processLeavin
gTail(ApplyTemplates.java:476)
>          at
net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:239)
>          at
net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.j
ava:199)
>          at
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:615)
>          at
net.sf.saxon.expr.instruct.Template.applyLeavingTail(Template.java:212)
>          at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:1034)
>          at
net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:237)
>          at
net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.j
ava:199)
>          at
net.sf.saxon.expr.instruct.Choose.processLeavingTail(Choose.java:794)
>          at
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:615)
>          at
net.sf.saxon.expr.instruct.Template.applyLeavingTail(Template.java:212)
>          at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:1034)
>          at
net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:237)
>          at
> net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemp
> lates.java:199)
>
> $ tail -1 idiffout.csv | awk 'BEGIN { FS=","; } { print NF " vs " $9 "
> }' -
> 3954 vs 53392
>
> I don't know if there is a better way to invoke the processor or not, nor if
I should try the .NET version instead.
> I suppose it is possible that something else in the overall transform is to
blame, but the transform exploded in the same spot.
>
> Kevin Bulgrien

This message and/or attachments may include information subject to GD
Corporate Policy 07-105 and is intended to be accessed only by authorized
personnel of General Dynamics and approved service providers.  Use, storage
and transmission are governed by General Dynamics and its policies.
Contractual restrictions apply to third parties.  Recipients should refer to
the policies or contract to determine proper handling.  Unauthorized review,
use, disclosure or distribution is prohibited.  If you are not an intended
recipient, please contact the sender and destroy all copies of the original
message.

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.