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

Subject: Re: [xsl] counting the number of time i call a template
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 19 Jan 2001 10:45:48 GMT
> My problem is that we can't modify global variables in
> xsl. But i need that functionality.

No, you don't need it (Side effect free languages are provavbly as
expressive as procedural languages).

> I have to count the number of time i call a template
No you need to generate a number based on some property of the
input. You just need to specify what that function is.

> Some of you will say ""you can use count select="//elt"
> in the root template", but in real life, my xml is not
> as simple,

If you said what the function is then someone could probably suggest
an XPath expression (probably in conjunction with xsl:number)
that would work.

If you did use an extension function to get the side effect of counting
or used saxon:assign then note that you would have no assurance that
you got the value that you want. templates may be evaluated in any
order, or in parallel. There is no assurance that the system builds the
tree in the same order that it is output.


This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit

 XSL-List info and archive:

Current Thread