[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Multi-level grouping across multiple input files
> then by the month of <actual>, <actual>5/7/2004 8:34:00 AM </actual> horrible format you have for dates:-) (single digits so not fixed length strings) (also I can't tell if you are using the inverted "amercian" order, so is that 5 or 7 you want? (apply suitable combinations of substring-before or substring-after below, then use format-number to force it to two digits. Then you want something like <xsl:variable name="input" select=" document('april.xml') | document('may.xml') | document('june.xml') | document('july.xml') | document('august.xml') | document('september.xml') "/> <xsl:key name="a" match="claim" use="vendorname"/> <xsl:key name="b" match="claim" use="concat(vendorname,':',format-number(substring-before...))"/> <xsl:key name="c" match="claim" use="concat(vendorname,':',format-number(substring-before...),':',loadnum)"/> <!-- that sets up keys for all three levels, the code below just does the first level group (this would be a lot easier in xslt2 draft) --> <xsl:for-each select="$input/claims/claim"> <!-- process all claims --> <xsl:variable name="ids"> <xsl:for-each select="$input"> <xsl:value-of select="generate-id(key('a',vendorname)") <xsl:text>:</xsl:text> </xsl:for-each> </xsl:variable> <!-- That has the id of the first claim in each doc that has this vendorname --> <xsl:if test="generate-id(.)=substring-before($ids,':')"> <!-- if this is true then we are on the first claim with this vendor in the collection, so proceess the group of all claims with this vendor, otherwise do nothing. --> heading: <xsl:value-of select="vendorname"/> <!-- make a heading for the group --> <xsl:for-each select="$inputs"> <xsl:apply-templates select="key('a',vendorname)"/> </xsl:for-each> <!-- apply templates to all claims in this group (this will need to do essentially the same again but with keys b and c to do the subgroups) --> </xsl:if> </xsl:for-each> <!-- finish up --> David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
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
|