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

Re: Grouping using concatenated key

Subject: Re: Grouping using concatenated key
From: jmcreynolds@xxxxxxxxxxxxxx
Date: Mon, 11 Dec 2006 12:47:54 -0600 (CST)
Re:  Grouping using concatenated key
David,
I want to extend a hearty thanks to you for your efforts this morning. 
You have given me enough to build upon and I really appreciate it!  It is
becoming clearer by the minute...

Many thanks,

JOHN

>
>> Does this clarify things?
>
> yes.
>
> change match="/" to match="NewDataset"
>
>
>
> <NewDataset>
>   <BillDetail>
>     <OBLIGATION_ID>2750</OBLIGATION_ID>
>     <PHONE_NUMBER>1234567890</PHONE_NUMBER>
>     <one/>
>   </BillDetail>
>   <BillDetail>
>     <OBLIGATION_ID>2750</OBLIGATION_ID>
>     <PHONE_NUMBER>1234567890</PHONE_NUMBER>
>     <two/>
>   </BillDetail>
>   <BillDetail>
>     <OBLIGATION_ID>2750</OBLIGATION_ID>
>     <PHONE_NUMBER>9876543210</PHONE_NUMBER>
>   </BillDetail>
>   <BillDetail>
>     <OBLIGATION_ID>3940</OBLIGATION_ID>
>     <PHONE_NUMBER>1234567890</PHONE_NUMBER>
>   </BillDetail>
> </NewDataset>
>
>
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
> <xsl:key name="byObligation" match="BillDetail" use="OBLIGATION_ID" />
> <xsl:key name="byObligationAndPhone" match="BillDetail"
> use="concat(OBLIGATION_ID, ':',PHONE_NUMBER)" />
>
> <xsl:strip-space elements="*"/>
> <xsl:output indent="yes"/>
>
> <xsl:template match="NewDataset">
>   <xsl:for-each
> select="BillDetail[generate-id()=generate-id(key('byObligation',OBLIGATION_ID))]">
>     <xsl:variable name="OBLIGATION" select="OBLIGATION_ID"/>
>     <group>
>       <xsl:for-each
> 	  select="../BillDetail[generate-id()=generate-id(key('byObligationAndPhone'
> 		  ,concat($OBLIGATION,':',PHONE_NUMBER)))]">
> 	<group>
> 	  <xsl:copy-of select="key('byObligationAndPhone'
> ,concat($OBLIGATION,':',PHONE_NUMBER))"/>
> 	</group>
>       </xsl:for-each>
>     </group>
>   </xsl:for-each>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
>
>
> saxon nds.xml nds.xsl
> <?xml version="1.0" encoding="utf-8"?>
> <group>
>    <group>
>       <BillDetail>
>          <OBLIGATION_ID>2750</OBLIGATION_ID>
>          <PHONE_NUMBER>1234567890</PHONE_NUMBER>
>          <one/>
>       </BillDetail>
>       <BillDetail>
>          <OBLIGATION_ID>2750</OBLIGATION_ID>
>          <PHONE_NUMBER>1234567890</PHONE_NUMBER>
>          <two/>
>       </BillDetail>
>    </group>
>    <group>
>       <BillDetail>
>          <OBLIGATION_ID>2750</OBLIGATION_ID>
>          <PHONE_NUMBER>9876543210</PHONE_NUMBER>
>       </BillDetail>
>    </group>
> </group>
> <group>
>    <group>
>       <BillDetail>
>          <OBLIGATION_ID>3940</OBLIGATION_ID>
>          <PHONE_NUMBER>1234567890</PHONE_NUMBER>
>       </BillDetail>
>    </group>
> </group>

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.