Re: template which parametrizes another template call
Mike Brown <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
Lensch, Thomas wrote: > Hi, > > i want to output many different table cells which follow exactly the > same layout. Data to be output comes in a raw format. It must be > transformed to a readable format. Therefore my layout template should > call a template to transform the data, using a output transformer which > is given by parameter. > > So i wrote the following template: > > <xsl:template name="outData"> > <xsl:param name="f_inhalt"/> > <xsl:param name="f_inhaltFormatter"/> > ..... do some layout things > <xsl:call-template name="$f_inhaltFormatter"> > <xsl:with-param name="param" > select="$f_inhalt"/> > </xsl:call-template> > .... do some more layout things > </xsl:template> > > If i run this i get an Error "template with name f_inhaltFormatter not > found" > It seems as if "f_inhaltFormatter" is not recognized as Variable but as > string. > > Does anybody know a good solution for my problem? It looks like no one ever responded to this. XSLT 1.0 does not allow variable references to be used as the name of the template to call. EXSLT does not offer any extensions to XSLT 1.0 for this purpose, either. XSLT 2.0 does allow variable references to be used, but XSLT 2.0 is not yet final and there are not many processors out there that support it. There is a workaround in XSLT 1.0. I believe it is demonstrated in the FXSL library -- see the articles at http://fxsl.sourceforge.net/ ...clever use of xsl:apply-templates, basically. Please follow up with this on the regular XSLT mailing list, xsl-list (info on how to join is at http://www.mulberrytech.com/xsl/xsl-list/index.html ) -Mike