|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Help needed: dynamically counting an attribute
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
|
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
|






