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

RE: Apply Templates question

Subject: RE: Apply Templates question
From: "Richard Lander" <rlander@xxxxxxxxxxxxx>
Date: Mon, 20 Oct 2003 10:53:39 -0700
how to apply templates
No, you cannot do this.

You would need something like the javascript "eval" function in order for the XSLT processor to evaluate the text as a template.

XSLT does not have a runtime way of executing generated code. I don't know if XSLT2 provides some facility in this area. You can, however, generate a transform and then execute that in a second pass on a document. You can also make your actual templates more dependent on passed params in order to provide more dynamic behaviour.

rich 

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Bennett
Sent: Monday, October 20, 2003 10:43 AM
To: xsl-list-digest@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Apply Templates question

Hello,

Is there a way to apply a template stored in a variable or param?


Example,
	In my test stylesheet, I currently have:

	...

<xsl:param name="template" select="'default'"/> <xsl:param name="testTemplate"/>

<xsl:template match="/">
	<xsl:apply-templates select="document('')/*"/> </xsl:template>

<xsl:template match="xsl:template[@name = '$template']">
	<xsl:param name="testTemplate"><xsl:copy-of select="."/></xsl:param> </xsl:template>

<xsl:template name="default">
	Made it to test.xsl - default template
</xsl:template>	
...


Which will allow a template to be selected based on a param but I'm not sure how to apply the template that gets stored in "testTemplate"
	(Or rather, how to apply the selected template once it's been matched by xsl:template[@name= '$template'])

Does anyone know where to go from here or have alternate suggestions?

TIA


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.