I am having a problem with the count function, which I am using within a group function.
Here is the xml I am trying to convert:
Code:
<dataroot>
<pavement_x0020_Conditions>
<BranchID>TWAWK</BranchID>
<Name>TAXIWAY A</Name>
<Condition>100</Condition>
<Method>PCI</Method>
<DATE>2006-10-05T00:00:00</DATE>
<SAMPLES>50</SAMPLES>
<NetworkID>WICKENBURG</NetworkID>
<SectionID>10</SectionID>
<Surface>AC</Surface>
<_Length>2164.08000000866</_Length>
<_Width>10.6680000000427</_Width>
<_Area_x0020_Adjustment>0</_Area_x0020_Adjustment>
</pavement_x0020_Conditions>
where there are several different possible values for <Surface> and hundreds of <pavement...> nodes
Here is my XSL file:
Code:
<xsl:template match="dataroot">
<xsl:for-each-group select="pavement_x0020_Conditions" group-by="Surface">
<xsl:sort select="Surface"/>
<record>
<Type><xsl:value-of select="Surface"/></Type>
<Sections><xsl:value-of select="count(SectionID)"/></Sections>
</record>
</xsl:for-each-group>
</main>
</xsl:template>
And this is what it puts out:
Code:
<record>
<Type>AC</Type>
<Sections>1</Sections>
</record>
<record>
<Type>APC</Type>
<Sections>1</Sections>
</record>
when there are dozens of AC and APC Sections. I think the problem has something to do with the grouping, but as far as I can tell, it should work. Any help would be greatly appreciated.
Thanks