Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSLT numbering by attribute

Reply
Thread Tools

XSLT numbering by attribute

 
 
James Merdan
Guest
Posts: n/a
 
      09-24-2003
Hi,
I'm having an issue I was hoping someone could help me with. I have
a number of tags which have an attribute 'type' like this:
<data file="file1.jpg" type="image"/>
<data file="file2.jpg" type="image"/>
<data file="file3.jpg" type="image"/>
<data file="file1.txt" type="text"/>
<data file="file2.txt" type="text"/>
<data file="file1.bin" type="binary"/>

etc...

Now I can get a total count by data/@type like this:
image : 3
text : 2
binary : 1

But what I want to be able to do is get a running total like this:
file1.jpg image 1 of 3
file2.jpg image 2 of 3
file3.jpg image 3 of 3
...

I'm stuck with the XML coming in the way it is, so is there a way to
do this with XSL?

Thanks,
James
 
Reply With Quote
 
 
 
 
Dimitre Novatchev
Guest
Posts: n/a
 
      09-24-2003
This is a grouping problem -- for a description of the Muenchian method for
grouping see:

http://www.topxml.com/code/default.a...20010129150851

and

http://jenitennison.com/xslt/grouping/index.html


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL



"James Merdan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi,
> I'm having an issue I was hoping someone could help me with. I have
> a number of tags which have an attribute 'type' like this:
> <data file="file1.jpg" type="image"/>
> <data file="file2.jpg" type="image"/>
> <data file="file3.jpg" type="image"/>
> <data file="file1.txt" type="text"/>
> <data file="file2.txt" type="text"/>
> <data file="file1.bin" type="binary"/>
>
> etc...
>
> Now I can get a total count by data/@type like this:
> image : 3
> text : 2
> binary : 1
>
> But what I want to be able to do is get a running total like this:
> file1.jpg image 1 of 3
> file2.jpg image 2 of 3
> file3.jpg image 3 of 3
> ...
>
> I'm stuck with the XML coming in the way it is, so is there a way to
> do this with XSL?
>
> Thanks,
> James



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT Sequential Numbering Liam XML 1 07-17-2007 12:30 PM
DOCBOOK/XSLT - Suppressing the automatic numbering Michael Doubez XML 1 01-27-2007 03:57 PM
sort and numbering - xslt pstachy XML 7 11-27-2006 11:15 PM
XSLT Newbie: Attribute Value transformed to Attribute Name bprimuslevy XML 1 08-23-2006 09:56 PM
XSLT: Making attribute to parent attribute Bostonasian XML 1 09-18-2005 07:30 AM



Advertisments