Subject: RE: [xsl] Grouping - Combining Nodes From: cknell@xxxxxxxxxx Date: Fri, 16 Dec 2005 11:11:23 -0500 |
Yes, it involves keys. Search the list archives for "Muenchian". -- Charles Knell cknell@xxxxxxxxxx - email -----Original Message----- From: Doug Rudder <drudder@xxxxxxxxxxxxx> Sent: Fri, 16 Dec 2005 09:21:44 -0600 To: "'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: [xsl] 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 ======================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Grouping - Combining Node, andrew welch | Thread | [xsl] CDATA in CDATA?, Silvia Liberto |
Re: [xsl] Grouping - Combining Node, andrew welch | Date | RE: [xsl] for-each-group, thomas . maciejewski |
Month |