|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Dynamically calling a template
> I was striving for the hypothetical (but illegal) solution of > <xsl:call-template name="$variable" /> (names cannot be variable). Three suggestions: (a) Have multiple task-oriented stylesheets each of which imports a stylesheet containing common components. Start the transformation by invoking a task-oriented stylesheet. The common code can call back using <xsl:call-template name="name" /> provided that each task-oriented stylesheet provides an implementation of "name": it doesn't have to be the same code in each one. (b) Use FXSL. This provides genuine higher-order programming, allowing you to pass functions around as parameters, so you can call a function that was supplied to you by your caller. (c) Use the central idea behind FXSL, without actually using FXSL itself (it has become quite a powerful monster). The central idea is to use an element as a surrogate for a template. Instead of doing <xsl:call-template name="$variable"/>, you do <xsl:apply-templates name="$variable"/>, where $variable holds an element that will be matched by the template you want to invoke (so there's a one-to-one correspondence between these elements and their corresponding templates). Michael Kay http://www.saxonica.com/
|
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
|

Cart








