xsl-list
[Top] [All Lists]

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

2012-04-14 06:09:35
On 13.04.2012, at 11:02, David Carlisle wrote:

do


<xsl:template match="*">
  ... <xsl:apply-templates 
select="(*,ancestor-or-self::*[following-sibling::*][1]/following-sibling::*)[1]/>
</xsl:template>

as that will match elements in the order
a,b1,c1,b2,c2,b3,c3
so you can pass information using parameters down that order.

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.

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. 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
--~------------------------------------------------------------------
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>
--~--