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

Re: [xsl] xsl:initial-template


Subject: Re: [xsl] xsl:initial-template
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Thu, 1 May 2014 14:15:03 -0000

On 1 May 2014 04:40, Max Toro <maxtoroq@xxxxxxxxx> wrote:
> If I understand correctly, in XSLT 3.0 you can initiate a
> transformation at a named template, but you are not required to
> provide a name because it uses "xsl:initial-template" as default. This
> replaces the convention of using "main" or any other kind of
> convention. Is this correct?

It's not to replace the traditional way of supplying an initial
template, it's an additional feature to allow us as stylesheet writers
to default the execution starting point in "standalone" stylesheets
(transforms that pull in the source data they use and don't require
user supplied input).

For example, imagine you had an xslt that pulled in some data from
various places and then created some reports.  If you gave that to
someone else to run repeatedly, you would currently need to also
supply a way of running it or explain how to supply the initial
template or how to run it against itself... it's a bit fiddly.  With
this new instruction you can just give them the xslt, and say "run
this".   It's not beyond the realms that they then run it by double
clicking it, or opening it in their browser etc.



-- 
Andrew Welch
http://andrewjwelch.com


Current Thread
Keywords