[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] "Tunneling" a parameter in document order

Subject: Re: [xsl] "Tunneling" a parameter in document order
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sat, 14 Apr 2012 15:48:01 +0100

On 14/04/2012 12:09, Christian Roth wrote:

Thanks David, this technique looks great and seems what I was looking
for. It took me a little while to understand how and why the
select="..." works, however :-)

Am I correct that by using the above, the maximum nesting depth of
template calls is the number of (here:) elements in the source
document? I tried with Saxon HE and got a "Too many nested
apply-templates calls. The stylesheet may be looping." error after
already 636 elements. I have to deal with documents eventually that
have>100k elements.

yes, if you write the templates such that they are tail recursive saxon should recycle the call stack and won't eat up so much stack space, but it's not always possible to write it as tail recursive, depends what the templates are generating.

I'll have to look into ways of avoiding that error, like reducing the candidate elements and "skipping" the ones for which I know that they will not change the tunnel variable's value so that I do not recurse into a template for them.
Yes or if there are branches were you don't need this at all as you know in advance you don't need to pass information from one branch to another, so can use <xsl:apply-templates/> on the parent at those points. It all depends....

> On the other hand, I am sure that
reasonable documents will have more than around 600 list items in
them, so that alone won't suffice.

Again, thanks for the great idea, and I now just need to work out the



Current Thread