[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

max from sequence problem

Subject: max from sequence problem
From: "Kent Seegmiller" <hookjaw20@xxxxxxxxxxx>
Date: Fri, 9 Feb 2007 18:30:55 -0700
 max from sequence problem
I am trying to get the max sum of each grp/@name for each date/@name to
scale it to a graph. I am using saxon8.7 xslt2.0 but get the error:
Error line 19 ... 
FORG0001: Failure converting {1 1 5 4 1 19 19...} to a number

My source
<?xml version="1.0" encoding="UTF-8" ?> 
<allloads>
  <firstdate>2007-01-28</firstdate> 
  <group name="PERISHABLE">
  <cons name="FROZEN">
  <date name="2007-01-28" skipdatecells="0">
  <grp name="1" count="1" skipcells="1" /> 
  <grp name="2" count="1" skipcells="0" /> 
  <grp name="3" count="1" skipcells="0" /> 
  </date>
  <date name="2007-01-29" skipdatecells="0">
  <grp name="1" count="2" skipcells="1" /> 
  <grp name="2" count="6" skipcells="0" /> 
  <grp name="3" count="3" skipcells="0" /> 
  </date>
  <date name="2007-01-30" skipdatecells="0">
  <grp name="0" count="7" skipcells="0" /> 
  <grp name="1" count="4" skipcells="0" /> 
  <grp name="2" count="1" skipcells="0" /> 
  </date>
  <date name="2007-01-31" skipdatecells="0">
  <grp name="0" count="2" skipcells="0" /> 
  <grp name="1" count="1" skipcells="0" /> 
  <grp name="2" count="3" skipcells="0" /> 
  </date>
  </cons>
  <cons name="DELI">
  <date name="2007-01-28" skipdatecells="0">
  <grp name="3" count="2" skipcells="3" /> 
  <grp name="4" count="1" skipcells="0" /> 
  <grp name="5" count="1" skipcells="0" /> 
  </date>
  <date name="2007-01-29" skipdatecells="0">
  <grp name="0" count="12" skipcells="0" /> 
  <grp name="1" count="10" skipcells="0" /> 
  <grp name="2" count="7" skipcells="0" /> 
  </date>
  <date name="2007-01-30" skipdatecells="0">
  <grp name="0" count="7" skipcells="0" /> 
  <grp name="1" count="4" skipcells="0" /> 
  <grp name="2" count="1" skipcells="0" /> 
  </date>
  <date name="2007-01-31" skipdatecells="0">
  <grp name="0" count="5" skipcells="0" /> 
  <grp name="1" count="3" skipcells="0" /> 
  <grp name="2" count="3" skipcells="0" /> 
  </date>
  </cons>
  </group>
  <group name="GROC">
  <cons name="GROC">
  <date name="2007-01-28" skipdatecells="0">
  <grp name="3" count="2" skipcells="3" /> 
  <grp name="4" count="3" skipcells="0" /> 
  </date>
  <date name="2007-01-29" skipdatecells="0">
  <grp name="0" count="9" skipcells="0" /> 
  <grp name="1" count="7" skipcells="0" /> 
  <grp name="2" count="6" skipcells="0" /> 
  </date>
  <date name="2007-01-30" skipdatecells="0">
  <grp name="0" count="16" skipcells="0" /> 
  <grp name="1" count="15" skipcells="0" /> 
  <grp name="2" count="9" skipcells="0" /> 
  </date>
  <date name="2007-01-31" skipdatecells="0">
  <grp name="0" count="7" skipcells="0" /> 
  <grp name="1" count="12" skipcells="0" /> 
  <grp name="2" count="9" skipcells="0" /> 
  </date>
  </cons>
  </group>
</allloads>



And my xsl:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">
<xsl:output method="xml"/>
<xsl:key name="grpdatetotal" match="grp" use="concat(../@name,'+',@name)"/>
<xsl:template match="/allloads">
<sums>
    <xsl:variable name="maxloads">
    <xsl:for-each-group select="./group/cons/date" group-by="@name">
      <xsl:variable name="dategroup" select="current-grouping-key()"/>
      <xsl:for-each-group select="current-group()" group-by="grp/@name">
      <xsl:variable name="groupGrp"
select="concat($dategroup,'+',current-grouping-key())"/>
      <xsl:sequence
select="sum(current-group()/key('grpdatetotal',$groupGrp)/@count)"/>
      </xsl:for-each-group>
    </xsl:for-each-group>
    </xsl:variable>
    <seq><xsl:value-of select="$maxloads"/></seq>
    <max><xsl:value-of select="max($maxloads)"/></max>
</sums>
</xsl:template>

</xsl:stylesheet>

What am I overlooking???  TIA

-Kent

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.