I searched all around to find a solution to my problem, but I had more questions ...
consider the following XML:
<dynamicStuff> <dyn id="name1">...</dyn> <dyn id="name2">...</dyn> <dyn id="name3">...</dyn> <dyn id="name4">...</dyn> </dynamicStuff>
and suppose I have an XSLT file as follows:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template name="name1"> ... </xsl:template> <xsl:template name="name2"> ... </xsl:template> <xsl:template name="name3"> ... </xsl:template> <xsl:template name="name4"> ... </xsl:template> </xsl:stylesheet>
What I want to do is from the SECOND XSLT file, which dynamically determines which template to call using the following:
<xsl:variable name="templateName"> <xsl:value-of select="dyn/@id"/> </xsl:variable> <xsl:call-template name="$templateName"/>
Unfortunately, this does not work, believe me, when I say that I have tried many different things, although it sounds so simple that it does not work either ...
Did I miss something?
Edit:
I have successfully completed the following:
<xsl:template name="staticName"> <xsl:param name="id" /> <xsl:if test="$id = 'name1'">....</xsl:if> <xsl:if test="$id = 'name2'">....</xsl:if> ... </xsl:template>
The call this way:
<xsl:call-template name="staticName"> <xsl:with-param name="id" select="@id"/> </xsl:call-template>
A needle to say how inconvenient it is ... first of all, my code will be attached to this staticName (imagine that I need to make this call in a dozen files) ... second I will have a bunch of (un) related content inside the same same template when it can be more divided ... a nightmare for updating the uu system
He does what I want, but not the way I need ...
Thanks in advance for any light on this!