[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Grouping using concatenated key
Subject: Re: [xsl] Grouping using concatenated key From: jmcreynolds@xxxxxxxxxxxxxx Date: Mon, 11 Dec 2006 12:47:54 -0600 (CST) |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Grouping using concatenat, David Carlisle | Thread | Re: [xsl] Grouping using concatenat, Mukul Gandhi |
[xsl] Dynamic Menu Using XSL, Brant Schroeder | Date | [xsl] the best approach, Sam Carleton |
Month |