[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Multi-level grouping across multiple input files
At 2004-10-12 21:17 -0600, Kent Seegmiller wrote:
First of all I want to know if this can be done. It can be done quite easily in a single run of a 1.0 stylesheet without using any vendor extensions. below is a sample of over 3000 claim nodes in each of 6 documents. Thats over 18000 nodes to process. I'll let you test the stylesheet below ... I created only three files of claims. I want to group by <vendorname>, then by the month of <actual>, then by <loadnum>. Use variable-based grouping ... a working example is below. You will see a number of posts by me on this approach if you Google the following: site:biglist.com "variable-based grouping" Is this possible using the document() function??? It is part of the solution, yes. I hope this helps. ........................ Ken
<xsl:output method="text"/> <xsl:variable name="claims" select="document('april.xml')//claim| document('may.xml')//claim| document('june.xml')//claim"/> <xsl:template match="/"> <xsl:for-each select="$claims"> <xsl:if test="generate-id(.)= generate-id($claims[vendorname=current()/vendorname])"> <xsl:text>Vendor name </xsl:text> <xsl:value-of select="vendorname"/>:
<xsl:text/> <xsl:variable name="vendors" select="$claims[vendorname=current()/vendorname]"/> <xsl:for-each select="$vendors"> <!--assuming MM/DD/YYYY--> <xsl:if test="generate-id(.)= generate-id($vendors[substring-before(actual,'/')= substring-before(current()/actual,'/')])"> <xsl:text> Month </xsl:text> <xsl:value-of select="substring-before(actual,'/')"/> <xsl:text>:
</xsl:text> <xsl:variable name="actuals" select="$vendors[substring-before(actual,'/')= substring-before(current()/actual,'/')]"/> <xsl:for-each select="$actuals"> <xsl:if test="generate-id(.)= generate-id($actuals[loadnum=current()/loadnum])"> <xsl:text> Load num </xsl:text> <xsl:value-of select="loadnum"/>:
<xsl:text/> <xsl:for-each select="$actuals[loadnum=current()/loadnum]"> <xsl:text> po </xsl:text> <xsl:value-of select="po"/> <xsl:text>
</xsl:text> </xsl:for-each> </xsl:if> </xsl:for-each> </xsl:if> </xsl:for-each> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> t:\ftemp>saxon kent.xsl kent.xsl Vendor name PINEAE GREEN HOUSE: Month 5: Load num 215560: po 1653730 Month 6: Load num 215560: po 1653730 Load num 215561: po 1653731 t:\ftemp>rem Done! -- Upcoming publicly-subscribed XSL delivery: Helsinki Oct 18-20,2004 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
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
|