[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: combine on key and dedupe

Subject: Re: combine on key and dedupe
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 23 Mar 2010 01:44:40 +0000
Re:  combine on key and dedupe
On 23/03/2010 01:38, Joyce Chapman wrote:
Any advice on how to do the following would be greatly appreciated. I
need to combine and dedupe a list of authors, compiling all children
of grouped<author>  into one<author>  (grouped on<authorizedName>),
but deduping the<authorizedName>. See example below. I think I need
to use an XSL 2.0 for-each-group, but am not sure how. Duplicate
author elements will not be adjacent to each other. Thanks for any
help!

Two author records for the same<authorizedName>:

<author>
   <authorizedName>Joe Bob</authorizedName>
   <nickName>J-Bob</nickName>
   <title>Title1</title>
</author>

<author>
   <authorizedName>Joe Bob</authorizedName>
   <nickName>Joe</nickName>
   <title>Title2</title>
</author>

Turn into a single author record, compiling all children but deduping
<authorizedName>:

<author>
   <authorizedName>Joe Bob</authorizedName>
   <nickName>Joe</nickName>
   <nickName>J-Bob</nickName>
   <exampleTitle>Title1</exampleTitle>
   <exampleTitle>Title2</exampleTitle>
</author>


<xsl:for-each-group select="author" group-by="authorizedName">
<copy>
<xsl:copy-of select="authorizedName,current-group()/(* except authorizedName)"/>
</xsl:copy>
</xsl:for-each-group>



or if necessary sorting teh children by name to bring them back together.


David

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.