[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: calling a template and xsl:include

Subject: Re: calling a template and xsl:include
From: Francesco Barresi <kywocs@xxxxxxxxx>
Date: Thu, 23 Sep 2004 18:56:31 -0400
xsl include dynamic
Thanks Michael,
The solution is very clever and kind of simple, I don't know why I
didn't thought that :P

Bye.


On Thu, 23 Sep 2004 16:57:20 +0100, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> > I have 2 questions:
> > I remember that I once saw somewhere a snippet of XSLT code about
> > calling a template having the name in a variable, something like this:
> >
> > <xsl:call-template select="$tempalteToCall"/>
> >
> > As far as I know this can't be done with XSLT 1.0, but there was a
> > work-around to do so.
> 
> Correct it can't be done in XSLT 1.0.
> 
> Saxon has an extension saxon:call-template that does this.
> 
> But there is a workaround that doesn't need extensions: it's a technique
> introduced by Dimitre Novatchev in his FXSL library. Essentially, if you
> have a template
> 
> <xsl:template name="x">
> 
> then add a match pattern:
> 
> <xsl:template name="x" match="dynamic:x"/>
> 
> Define a variable whose value is a node:
> 
> <xsl:variable name="dynamic:x"><dynamic:x/></xsl:variable>
> 
> Now you can define a variable:
> 
> <xsl:variable name="templateToCall" select="$dynamic:x/*"/>
> 
> and do:
> 
> <xsl:apply-templates select="$templateToCall"/>
> 
> which in this case will call the template dynamic:x, but can be adapted to
> call whatever template the variable templateToCall is set to.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> 
> Any one know how to do that or where to find
> > info about that? It would help.
> >
> > The other question is about performance. I use many xsl:include and I
> > would like to know if this could cause some notable performance issue
> > on the processor?
> >
> > Thanks.
> > Bye
> >
> > Francesco.
> > --
> > www.GetFirefox.com !!
> 
> 



-- 
www.GetFirefox.com !!

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.