Date: Thu, 3 Mar 2005 04:34:09 -0800 (PST)
From: Mukul Gandhi <mukul_gandhi(_at_)yahoo(_dot_)com>
Message-ID:
<20050303123410(_dot_)39196(_dot_)qmail(_at_)web41311(_dot_)mail(_dot_)yahoo(_dot_)com>
[...]
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 < 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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--