This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: different templates
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] different templates
- From: Goetz Bock <bock at blacknet dot de>
- Date: Mon, 29 Oct 2001 10:53:59 +0100
- References: <3BDD217D.7000708@globalpark.de>
- Reply-To: xsl-list at lists dot mulberrytech dot com
On Mon, Oct 29 '01 at 10:29, Ingo Friepoertner wrote:
> I (think I) need 2 different apply-templates which match the same xml
> node in a stylesheet.
What for?
> How can I do this without conflicts?
>
> <xsl:template match="var"> <!-- foo --> </xsl:template>
> <xsl:template match="var"> <!-- bar --> </xsl:template>
Not at all, how should the processor (or anyone else) know when to use
which template?
> Well, there must be a simple solution ...
> Problem: I need the elements and id's from 'vars' in different parts of
> html output.
You could use:
- modes
<xsl:template match="var"> <!-- foo --> </xsl:template>
<xsl:template match="var" mode="ids"> <!-- bar --> </xsl:template>
and use
<xsl:apply-templates />
<xsl:apply-templates mode="ids" />
- for-each
<!-- ... build your result -->
<xsl:for-each select="var/@id">
<!-- print id -->
</xsl:for-each>
- there are more ways for sure ;-)
--
Goetz Bock IT Consultant
Dipl.-Inf. Univ.
PGP signature