Subject: Newbie Question: call-template name="$variable" From: jkraai@xxxxxxxx Date: Fri, 26 May 2000 09:27:06 -0500 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: human-talk for "::", Juergen Hermann | Thread | RE: Newbie Question: call-template , Kay Michael |
Re: ### Outputting the "full path"., David Carlisle | Date | Re: How would you add depth to this, Eric G. Bosch |
Month |