|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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>
Using Xalan.
Get this error:
XSL Error: Could not find template named: $record_type
XSL Error: SAX Exception
Yes, templates of the right names are in the file.
Using this call-template statement:
<xsl:call-template name="{$record_type}"/>
gives:
XSL Error: Could not find template named: {$record_type}
Looking in the spec Sect. 6, it says that QNAMEs can be used
in a call-template. Variables are QNAMEs according to sect.
2.4.
It seems that the QNAME isn't getting expanded early enough
in the process. Or that some variable bindings are happening
a lot earlier than others. Or something like that. I can't
find in the spec where this is disallowed.
Attempting to avoid using variables and going directly
with a query, the example in sect. 7.6.2 Attribute Value
Templates suggests to my hopeful psyche that I might be
able to get away with something like this ...
Using this call-template statement:
<xsl:call-template name="{@TYPE}"/>
gives:
XSL Error: Could not find template named: {@TYPE}
Help! Where am I going wrong? Any suggestions for "the
right" way to accomplish this w/o doing this:
<xsl:variable name="record_type" select="@TYPE"/>
<xsl:choose>
<xsl:when test="$record_type='type1'>
<xsl:call-template name="type1"/>
</xsl:when>
<xsl:when test="$record_type='type2'>
<xsl:call-template name="type2"/>
</xsl:when>
<user:elipses>...</user:elipses>
<xsl:otherwise>
<xsl:call-template name="type2"/>
</xsl:otherwise>
</xsl:choose>
would be much appreciated.
Thanks,
--jim
------------------------------------------------------------------
You've received MurlMail! -- FREE, web-based email, accessible
anywhere, anytime from any browser-enabled device. Sign up now at
http://murl.com
Murl.com - At Your Service
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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








