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
t:\ftemp>type april.xml
<claims>
<claim claimable="no">
<vendorcode>P0110</vendorcode>
<vendorname>PINEAE GREEN HOUSE</vendorname>
<vendorRollontime> 100 </vendorRollontime>
<vendorontime> 100 </vendorontime>
<cons> 105 </cons>
<carrier>PINEAE GREENHOUSE</carrier>
<carrierontime> 97 </carrierontime>
<loadnum>215560</loadnum>
<po>1653730</po>
<due>5/7/2004 </due>
<original>5/7/2004 8:45:00 AM </original>
<scheduled>5/7/2004 8:45:00 AM </scheduled>
<actual>5/7/2004 8:34:00 AM </actual>
<vendstat>On Time</vendstat>
<carrierstat>On Time</carrierstat>
<buyer>???</buyer>
</claim>
</claims>
t:\ftemp>type may.xml
<claims>
<claim claimable="no">
<vendorcode>P0110</vendorcode>
<vendorname>PINEAE GREEN HOUSE</vendorname>
<vendorRollontime> 100 </vendorRollontime>
<vendorontime> 100 </vendorontime>
<cons> 105 </cons>
<carrier>PINEAE GREENHOUSE</carrier>
<carrierontime> 97 </carrierontime>
<loadnum>215560</loadnum>
<po>1653730</po>
<due>5/7/2004 </due>
<original>5/7/2004 8:45:00 AM </original>
<scheduled>5/7/2004 8:45:00 AM </scheduled>
<actual>6/7/2004 8:34:00 AM </actual>
<vendstat>On Time</vendstat>
<carrierstat>On Time</carrierstat>
<buyer>???</buyer>
</claim>
</claims>
t:\ftemp>type june.xml
<claims>
<claim claimable="no">
<vendorcode>P0110</vendorcode>
<vendorname>PINEAE GREEN HOUSE</vendorname>
<vendorRollontime> 100 </vendorRollontime>
<vendorontime> 100 </vendorontime>
<cons> 105 </cons>
<carrier>PINEAE GREENHOUSE</carrier>
<carrierontime> 97 </carrierontime>
<loadnum>215561</loadnum>
<po>1653731</po>
<due>5/7/2004 </due>
<original>5/7/2004 8:45:00 AM </original>
<scheduled>5/7/2004 8:45:00 AM </scheduled>
<actual>6/7/2004 8:34:00 AM </actual>
<vendstat>On Time</vendstat>
<carrierstat>On Time</carrierstat>
<buyer>???</buyer>
</claim>
</claims>
t:\ftemp>type kent.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<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(_at_)CraneSoftwrights(_dot_)com
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