[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: different templates

Subject: Re: different templates
From: Goetz Bock <bock@xxxxxxxxxxx>
Date: Mon, 29 Oct 2001 10:53:59 +0100
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.

Attachment: pgp00017.pgp
Description: PGP signature

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.