This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: apply-import and named templates
- To: Kelly Campbell <camk at channelpoint dot com>
- Subject: Re: [xsl] apply-import and named templates
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Tue, 27 Feb 2001 09:34:18 +0000
- CC: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <E583503B7F57D41196A600D0B76FDDD5DD0788@cpex2.channelpoint.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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