[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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>
|
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
|