This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Newbie Question: call-template name="$variable"


> Here's what I want to do:
> 
> <!-- For Each Recordset/Record ... -->
> <xsl:template match="RECORD">
>   <TR>
>     <xsl:variable name="record_type" select="@TYPE"/>
>     <xsl:call-template name="$record_type"/>
>   </TR>
> </xsl:template>
> 

Well you can't, sorry! The name has to be a QName, it can't be an
expression, and it can't be an attribute value template. A QName can't have
a "$" in it.

It looks to me as if your situation can be handled by changing
<xsl:call-template ...> to <xsl:apply-templates mode="x"/>, 
and replacing
<xsl:template name="type1"> by <xsl:template match="RECORD[@TYPE='type1']"
mode="x">

If you really need to call a named template decided at run-time, you can do
it in Saxon as 
<xsl:call-template name="{$rectype}" saxon:allow-avt="yes"/>

Mike Kay


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]