?
Solved

Xsl:call-template

Posted on 2002-06-13
4
Medium Priority
?
279 Views
Last Modified: 2011-09-20
Can the name attribute of a xsl:call-template be a xsl variable or xml tag?

I want the calling template name as a variable.

like
<xsl:call-template name="$tname"/> (But this will give an error)

How to achieve this?
0
Comment
Question by:dsraja
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Expert Comment

by:vindevogel
ID: 7086936
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="D:\Projects\XML Framework\Untitled2.xsl"?>
<xml>
     <circle radius="10"/>
     <rectangle length="20" height="30"/>
</xml>


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

     <xsl:template match="/xml">
          <xsl:for-each select="*">
               <xsl:apply-templates select="."/>
          </xsl:for-each>
     </xsl:template>
     
     <xsl:template match="circle">
          <p>I'm a circle with radius <xsl:value-of select="@radius"/></p>
     </xsl:template>
     
     <xsl:template match="rectangle">
          <p>I'm a rectangle</p>
     </xsl:template>
</xsl:stylesheet>




Something like this ??
0
 
LVL 6

Accepted Solution

by:
Wayne Bradney earned 80 total points
ID: 7165863
dsraja,

Calling a template whose name is decided at run-time is not possible in XSLT.

For more info see the spec at:
http://www.w3.org/TR/xslt#attribute-value-templates
http://www.w3.org/TR/xslt#named-templates

Regards,
WMB
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question