xsl-list
[Top] [All Lists]

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

2012-04-14 09:48:15
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
details...

-Christian

David


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--