[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Grouping - Combining Nodes
Subject: [xsl] Grouping - Combining Nodes From: Doug Rudder <drudder@xxxxxxxxxxxxx> Date: Fri, 16 Dec 2005 09:21:44 -0600 |
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 =======================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] [ANNOUNCE] Dr. Michael Kay Sh, Stylus Studio | Thread | Re: [xsl] Grouping - Combining Node, andrew welch |
RE: [xsl] Newby XSLT symbol questio, drkm | Date | Re: [xsl] Grouping - Combining Node, andrew welch |
Month |