Subject: [xsl] Incrementing a counter From: "Warren, Keith" <KWARREN@xxxxxxxxxxxxxxxxxxx> Date: Wed, 13 Jun 2007 18:36:30 -0500 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSLT and XML Schema, Michael Kay | Thread | Re: [xsl] Incrementing a counter, David Carlisle |
Re: [xsl] XSLT and XML Schema, Kamal Bhatt | Date | Re: [xsl] Incrementing a counter, David Carlisle |
Month |