question about call-template
[Apologies if anybody has seen this message before. I'm pretty sure the listserv never sent it out the first time, but the archive on Mulberry's web site is broken and I can't check to make sure.] I'm stumped. I've learned how to write a template. Ditto for calling a template by name, and for passing parameters to a template. I can't find a way to pass the *name* of a template to another template, and then call that template by that name. In other words, something like: <xsl:template match="/"> <html><body> <xsl:call-template name="A"> <xsl:with-param name="Tpl">B</xsl:with-param> </xsl:call-template> </body></html> </xsl:template> <xsl:template name="A"> <xsl:param name="Tpl"></xsl:param> <xsl:call-template name="$Tpl"></xsl:call-template> </xsl:template> <xsl:template name="B"> <HR/> </xsl:template> Should this be possible? I'm using IBM's XSL processor, but when I try this I just get: "XSL Error: Could not find template named: '$Tpl' Basically what I'm looking for is the same kind of functionality you get in languages that allow you to pass a function by reference. That way I could create one template that did common processing, and pass a specialized template to it to handle issues specific to the portion of the document tree I'm trying to process (eg: create a generic reusable table layout vs dealing with content-specific layout issues in the rows). Thanks in advance for any assistance. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format