Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Help needed: dynamically counting an attribute

From: Ali.Naddaf@-----------
To:
Date: 7/3/2000 11:27:00 AM
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


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent