This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: different templates



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]