[xsl] Re: counting the number of time i call a template

Subject: [xsl] Re: counting the number of time i call a template
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 19 Jan 2001 04:28:34 -0800 (PST)
Floch "Jean-Sébastien" wrote:
> But i need that functionality.
> I have to count the number of time i call a template

Here's the outline of a general solution:

1. Call any template that you want to count from within the contents of
an xsl:variable.

2. Code all such templates to produce first an element with a name that
will uniquely identify the template (e.g. "calledTemplateName"). 

3. Apart from the above "tracing output" a template will function in
almost the same way -- one notable requirement will be to reference any
nodes of the source xml document through a global variable, that has
been assigned the root node of the source document.

4. When the transformation has been performed, the RTF will contain all
"normal output" plus all "tracing output". The count of the nodes of
the "tracing output" having a particular name will be the count of
times a particular template was called.

5. To produce only the "normal output", the RTF should be finally
filtered/copied.

Dimitre.

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread