[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Grouping - Combining Nodes
Venerable XSLT Sages - I'm using XSLT 1.0 to pull content from an XML data set to build a class index. I've solved the first two pieces of the puzzle: Extract the information from each drug topic and sort the index by class-name. However, I'm bogged down and the third part: When multiple index entries have the same class-name, combine them into a single index entry. For example, in the snippet below, there are four class-items, sorted alphabetically. The middle two have the same class name: <class-index> <class-item> <class-name>Aminoglycoside</class-name> <class-reflist> <class-ref xref="fandc-atoz0479">Kanamycin Sulfate</class-ref> </class-reflist> </class-item> <class-item> <class-name>Analgesic</class-name> <class-reflist> <class-ref xref="fandc-atoz0483">Ketoprofen</class-ref> </class-reflist> </class-item> <class-item> <class-name>Analgesic</class-name> <class-reflist> <class-ref xref="fandc-atoz0484">Ketorolac Tromethamine</class-ref> </class-reflist> </class-item> <class-item> <class-name>Anti-infective</class-name> <class-reflist> <class-ref xref="fandc-atoz0482">Ketoconazole</class-ref> </class-reflist> </class-item> </class-index> I would like to combine those two into a single class-item that references all related drug topics (basically move all related class-ref elements into the same class-item under the class-name): <class-index> <class-item> <class-name>Aminoglycoside</class-name> <class-reflist> <class-ref xref="fandc-atoz0479">Kanamycin Sulfate</class-ref> </class-reflist> </class-item> <class-item> <class-name>Analgesic</class-name> <class-reflist> <class-ref xref="fandc-atoz0483">Ketoprofen</class-ref> <class-ref xref="fandc-atoz0484">Ketorolac Tromethamine</class-ref> </class-reflist> </class-item> <class-item> <class-name>Anti-infective</class-name> <class-reflist> <class-ref xref="fandc-atoz0482">Ketoconazole</class-ref> </class-reflist> </class-item> </class-index> Can this be done in XSLT 1.0. If so, how? Any tips will be appreciated. ======================= Douglas Rudder XML Analyst WoltersKluwer Health - Clinical Tools 77 West Port Plaza, Suite 450 Phone: 314-216-2227 e-mail: drudder@xxxxxxxxxxxxx www.drugfacts.com =======================
|
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
|