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

RE: xsl:template having both name and match

Subject: RE: xsl:template having both name and match
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Thu, 3 Mar 2005 14:46:37 +0200
rammstein templates
Hi,

> Hello,
>   I have a question about xsl:template ..
>
> It is said in XSLT 2.0 spec that..
> "If an xsl:template element has a name attribute, it
> may, but need not, also have a match attribute.
>
> The match, mode and priority attributes on an
> xsl:template element have no effect when the template
> is invoked by an xsl:call-template instruction.
> Similarly, the name attribute on an xsl:template
> element has no effect when the template is invoked by
> an xsl:apply-templates instruction."
>
> I think this is also true in case of XSLT 1.0 ..
>
> This means that we can write a xsl:template having
> *both* name and match attributes..
>
> I want to know in which circumstances such a template
> definition is useful.. Can somebody please provide an
> example where this has real practical use..?

<xsl:template name="block/title" name="section.heading">
  <xsl:param name="content">
    <xsl:apply-templates/>
  </xsl:param>
  <h2>
    <xsl:copy-of select="$content"/>
  </h2>
</xsl:template>

When you want to use the same template to generate headings for both matched
title elements and autogenerated content.

Cheers,

Jarno - Rammstein: Moskau

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.