Subject: Re: [xsl] Performance differences between xsl:for-each and xsl:template matches From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 16 Aug 2022 17:56:01 -0000 |
On Tue, 2022-08-16 at 17:12 +0000, Edward Porter edward.porter@xxxxxxx wrote: > I inherited an older stylesheet that makes extensive use of <xsl:for- > each> matching elements (e.g., select="//chapter[@eid]") in the root > template to then call templates. Using Saxon, would there be any > performance improvements if I refactored to use match templates and > <xsl:apply-templates> as would generally be the best practice in this > case? The first thing i'd look at is whether you can replace a whole bunch of for-each mappings with a single apply-templates instruction. The // in your example walks the entire document tree (in principle) making a list of all chapter elements with an eid attribute. If you can replace lots of similar things with a *single* treewalk using apply-templates it'll likely go faster. There's rarely a single answer for performance questions. liam -- Liam Quin - paligo.net, delightfulcomputing.com Cancer gofundme https://www.gofundme.com/f/5u9v7-every-little-helps Vintage pictures & texts https://www.fromoldbooks.org/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Performance differences betwe, Edward Porter edward | Thread | Re: [xsl] Performance differences b, Michael Kay mike@xxx |
[xsl] Performance differences betwe, Edward Porter edward | Date | Re: [xsl] Performance differences b, Michael Kay mike@xxx |
Month |