Subject: Re: [xsl] String conversion problem when string is large From: Michael Kay <mike@xxxxxxxxxxxx> Date: Tue, 20 Mar 2012 23:50:24 +0000 |
Try changing this:Sadly, it's a very common mistake. Any variable-like element with content (xsl:variable, xsl:param, xsl:with-param) creates a temporary tree; in this case a tree containing a document node and a single text node child. That's a much more heavyweight data structure than a simple string, as your memory problems demonstrate. It behaves like a string in most circumstances, but not all - for example, conversion to a boolean behaves differently. That makes it quite hard to optimize. Saxon does its best by using a special tree model that can only hold a document node with a single text node child. I happened to notice in your stack trace that this wasn't being used here, it was using a standard TinyTree - I'm not sure why the optimization isn't kicking in, there can be any number of reasons. But using a string is so much better, it reduces the size of your code and makes all this optimization effort (which is really just amelioration of bad code) completely unnecessary.
<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.
...
That resulted in success.
... I have much to learn. Those two things look identical to me.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] String conversion problem, Bulgrien, Kevin | Thread | Re: [xsl] String conversion problem, Wendell Piez |
RE: [xsl] String conversion problem, Bulgrien, Kevin | Date | Re: [xsl] Stylesheet analysis/docum, team wise |
Month |