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

Re: Using variables in xpath attribute matches

Subject: Re: Using variables in xpath attribute matches
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Fri, 22 Aug 2008 17:58:36 +0530
Re:  Using variables in xpath attribute matches
On Fri, Aug 22, 2008 at 2:50 PM, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote:
> Remember one of the golden rules for people learning XSLT - don't use
> named templates!
>
> One of the worst sins of XSLT is not understanding the recursive
> descent processing model (apply-templates and template matching) and
> instead just using named templates passing around the context as
> param:

My personal opinion is, this is a bit over statement ...

Please consider this example,

<xsl:variable name="temp">
  <xsl:call-template name="handleSomeElem">
    <xsl:with-param select="$current/elem"/>
  </xsl:call-template>
</xsl:variable>

<!-- do something with $temp, after the previous call -->

<xsl:template name="handleSomeElem">
 <xsl:param name="elem">

 <!--
  Generate some XML fragment. Could be
  a big one.
  e.g.
  <x>
    <y/>
  </x>
 -->
</xsl:template>

Many a times, I like the above style (for a requirement like this), as
compared to using xsl:apply-templates or xsl:function.


-- 
Regards,
Mukul Gandhi

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.