xsl-list
[Top] [All Lists]

Re: calling templates depending on content

2004-10-29 09:37:12
Still tweaking David,

At 05:20 AM 10/29/2004, he wrote:
> Is there a better way (XSL1.0) to call a template depending on
> "/main/template/@name"?

replace

<xsl:template name="start">

by

<xsl:template match="@name='start'">

but he meant

<xsl:template match="@name[.='start']">...</xsl:template>
<xsl:template match="@name[.='query']">...</xsl:template>

etc.

and replace all of

 <xsl:choose>
  <xsl:when test="/main/template/@name = 'start'">
   <xsl:call-template name="start"/>
  </xsl:when>
  <xsl:when test="/main/template/@name = 'query'">
   <xsl:call-template name="query"/>
  </xsl:when>
  ...
 </xsl:choose>

by

<xsl:apply-templates select="/main/template/@name"/>

Yeah. (Or do it Mike's way.)

Cheers,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================