Incrementing a counter
I'm a newbie to XSLT, but have a lot of scripting experience. 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? My problem is that I need to to create a single header that appears over a list of similar items. In the XML file, we store the "Category" attribute. So I may have 20 Sports items, 10 News items and 5 Features items. I need to transform the XML into a text file that should look like this: Sports 1. 2. 3. etc News 1. 2. 3. etc Features 1. 2. 3. etc 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 How would I achieve that with XSLT? Thanks, KW
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format