[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: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Mon, 7 Mar 2005 08:49:59 -0800 (PST)
dbtucker
Thank you for providing a nice example..

Regards,
Mukul

--- Dave Tucker <dbtucker@xxxxxxxxxx> wrote:
> > Date: Thu, 3 Mar 2005 04:34:09 -0800 (PST)
> > From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
> > Message-ID:
> <20050303123410.39196.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
> > 
> > [...]
> > 
> > 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..?
> > 
> > Till now I have'nt felt such a need.. I always
> create
> > xsl:template with name and match attributes as 2
> > seperate templates, and never in a single
> template.. I
> > want to know the practical use when both name and
> > match attributes on xsl:template would be
> required..
> 
> Yes, it has a practical use.
> 
> I use this capability to write templates where the
> first invocation
> comes from matching some source element, and
> subsequent invocations
> are from recursive calls.  For example:
> 
>   <xsl:template match="insert-events"
> name="insert-events">
>     <xsl:param name="days-from-now">0</xsl:param>
> 
>     <xsl:if test="$days-from-now &lt; 7">
>       <!-- process this day -->
>       <!-- ... -->
> 
>       <!-- recursively call insert-event for next
> day -->
>       <xsl:call-template name="insert-events">
>         <xsl:with-param name="days-from-now"
> select="$days-from-now + 1"/>
>       </xsl:call-template>
>     </xsl:if>
>   </xsl:template>
> 
> Notice that this pattern also relies on having
> default parameter
> values.
> 
> Dave



	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

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.