[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Help needed: dynamically counting an attribute

Subject: Help needed: dynamically counting an attribute
From: Ali.Naddaf@xxxxxxxxxxx
Date: Mon, 3 Jul 2000 16:26:37 -0500
ali naddaf
Hi everyone. 
I have the following question. Assume that I have the following XML file,
("........" represents some removed irrelevant lines):

<CPU partNum="1345"> 
.............
<CPU partNum="15678">
............
<CPU partNum="1345">
..............
<CPU partNum="11111">
..............
<CPU partNum="11111">
............
<CPU partNum="1345">
..........
<CPU partNum="11111">
.........


and I want to write a stylesheet such that after parsing this XML file, it 

counts the number
of those elements which have the same partNum and report that in some way, 

say in a table 
(in HTML) like the following:

partNum     Qty
1345             3
15678           1
11111           3

The difficulty that I have is the following: I have different XML files 
(with similar structure)
in which, these partNum are different , and may even change in the future, 

so I cannot use a
static counter since I don't know exactly what I should match against (and 

I don't want to hard code all
the possible partNum which may be even unknown!).   I need a smart 
stylesheet
such that it parses the XML file and dynamically, based on whatever number 

appears in partNum
attribute, starts counting them. I hope I am clear about what I need and 
what my problem is. 
I am not picky about the output format, so the above "table" for output 
was just an example to 
show the idea. 

Many thanks, 
Ali Naddaf.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.