[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: RE: Newbie Question: call-template name="$variable"
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 26 May 2000 16:22:51 +0100
xsl 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.