I have a problem that I cannot solve and would appreciate some help.
From what I understand about variables in XSLTs, you can't
change the value. So if that's true, how can I increment a counter?
You need to think about a higher-level description of your problem, and not
about how you would solve it in an imperative programming language.
In my scripting experience, I would sort the list by
category, create a counter and loop through the list of items
comparing each subsequent item to the previous item. It it
was the same, I would ignore the category. That may not be
the most elegant solution, but it works
This "sorting and comparing to the previous category" is a procedural
algorithm for doing grouping. Grouping in XSLT 2.0 is done using
xsl:for-each-group; in 1.0 it's done (clumsily) using keys as described at
http://www.jenitennison.com/xslt/grouping.
Numbering items within a group can be done using the position() function.
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
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>
--~--