Re: [xsl] apply-import and named templates

Subject: Re: [xsl] apply-import and named templates
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 27 Feb 2001 09:34:18 +0000
Hi Kelly,

> Is there a way to do the equivalent of <xsl:apply-imports/> on a
> named template? The spec mentions match templates only in the
> discussions about imports and conflict resolution, and Xalan-J 2 has
> a stack overflow if I try to use something like the following.

There isn't a way to do something like xsl:apply-imports with named
templates.

However, you might be able to change your named templates into
equivalent moded templates and thus be able to use xsl:apply-imports
instead.  If you change your templates to:

 file:///common.xsl:
 ------------------------------
 <xsl:template match="node()" mode="foo">
 bar
 </xsl:template>


 file:///special.xsl:
 ------------------------------
 <xsl:import href="common.xsl"/>
 
 <xsl:template match="node()" mode="foo">
 foo<xsl:apply-imports/>
 </xsl:template>
 ------------------------------

and then 'call' this moded template with:

  <xsl:apply-templates select="." mode="foo" />

rather than:

  <xsl:call-template name="foo" />

then that should work as you want it.

Of course there may be other ways around it - perhaps you can change
the name of the template in the importing stylesheet, and call the one
you're importing from within it?

I hope that helps anyway,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread