The following transformation achieves the same (level values are monotonous
but not strictly consecutive, container/item info not used) and at the same
time is twice shorter and considerably less complex.
It is just 33 lines (compared to 66 lines) and consists of just two
templates one of which has one parameter and the other no parameters
(compared to three templates one of which takes two parameters and another
which takes four parameters):
Dimitre,
in my code I was trying to get rid of exponential computation times, so popular
for XLST grouping problem, but often inadequate. My template processes 100
lines
in 2 seconds, yours in 9 seconds. The same 100 lines repeated twice take 4
seconds
with my template, and 106 seconds with yours.
Of course, it depends on the problem to solve, but a couple of hundreds of
entries
in a hierarchical table of contents is not uncommon.
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list