View Single Post
  #1 (permalink)  
Old June 23rd, 2006, 03:36 PM
tslag tslag is offline
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sum function and XPath problems

Ok, sorry for all the posts, but this is very hard for me to get for some reason. I want to sum several dozen values and present them, but the sum function is returning very small numbers, perhaps just the first number it comes to. Again, I think this is from my grouping troubles. Here is the code:
source file:
Code:
<dataroot>

<pavement_x0020_Conditions>

<BranchID>TH01PM</BranchID>
<NetworkID>PAGE</NetworkID>
<Name>PAGE MUNICIPAL AIRPORT</Name>
<Condition>100</Condition>
<Method>PCI</Method>
<DATE>2006-05-24T00:00:00</DATE>
<SAMPLES>25</SAMPLES>
<Inspected_x0020_Area>12746.297088</Inspected_x0020_Area>
<Inspected_x0020_Use>TAXIWAY</Inspected_x0020_Use>
<SectionID>20</SectionID>
<Surface>AC</Surface>

</pavement_x0020_Conditions>
Where there are hundreds of <pavement...> nodes and several different <Inspected_x0020z_Use> values.
and the xsl file:
Code:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:template match="dataroot">
<main caption="Table Title" headertextfont="Arial" headertextcolor="0xFFFFFF" rowtextfont="Arial" rowtextcolor="0x000000" headercolor="0x5372aa" rowcolor="0xFFFFFF" altrowcolor="0xcccccc">

    <xsl:for-each-group select="pavement_x0020_Conditions" group-by="Inspected_x0020_Use">
      <xsl:sort select="Inspected_x0020_Use"/>
<record>    
    <Use><xsl:value-of select="Inspected_x0020_Use"/></Use>
    <Area><xsl:value-of select="sum(current-group()/Inspected_x0020_Area)"/></Area>
</record>
</xsl:for-each-group>
</main>
</xsl:template>
</xsl:stylesheet>
I need to get the area of each Inspected Use, of which there are several types. I used a method very similar to what was suggested in my previous post, and it doesn't seem to add anything. I think I am just pointing at the wrong thing. Any ideas?
Reply With Quote