RE: Calling a template from within an template

Subject: RE: Calling a template from within an template
From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx>
Date: Fri, 5 Nov 1999 17:04:50 -0400 (EST)
At 5 Nov 1999 14:36 -0700, Mike Brown wrote:
...
 > > Here is what I really want to do:
 > > 
 > > <xsl:template match="h1">
 > > 	<h1>
 > >    	    <xsl:call-template name="stdTemplate"/>        	
 > > 	</h1>
 > > </xsl:template>
 > > 
 > > <xsl:template match="h2">
 > > 	<h2>
 > >          <xsl:call-template name="stdTemplate"/>        	
 > > 	</h2>
 > > </xsl:template>
 > 
 > Easy. Hopefully you are using an XSLT processor that implements these
 > instructions:
 > 
 > <xsl:template match="h1|h2|whatever">
 >    <xsl:element name="name(.)">
 >       <xsl:call-template name="stdTemplate">
 >          <xsl:with-param name="currentnode" select="."/>
 >       </xsl:call-template>
 >    </xsl:element>
 > </xsl:template>
 > 
 > <xsl:template name="stdTemplate">
 >    <xsl:param name="currentnode"/>
 >    ...stuff that processes currentnode goes here...
 > </xsl:template>

You don't really need <xsl:param name="currentnode"/> since
xsl:call-template does not change the current node or the current node
list (see section 6 of the PR).

Hopefully even the called template won't be needed since whatever is
inside the called template can now go inside the xsl:name.

Regards,


Tony Graham
======================================================================
Tony Graham                            mailto:tgraham@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9632
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread