sum function and formatting
Posted: Tue May 24, 2005 12:55 pm
Hi there,
I am trying to sum some coordinates, afterwards I want to format them and display the issue.
I tried the following but it didn't work out.
The source looks like this:
On the display it says that it is not a number, so I used "number" to convert it but it didn't work as well.
Maybe somebody could give me a tip..
cheers
andy
I am trying to sum some coordinates, afterwards I want to format them and display the issue.
I tried the following but it didn't work out.
Code: Select all
<xsl:template name="x">
<xsl:variable name="x_sum" select="sum(xplan:position/gml:Polygon/gml:exterior/gml:LinearRing/gml:pos[substring-before(.,' ')])"/>
<xsl:variable name="x_count" select="count(xplan:position/gml:Polygon/gml:exterior/gml:LinearRing/gml:pos)"/>
<xsl:variable name="x_format" select="format-number($x_sum, '#')"/>"
<xsl:variable name="x_rw" select="3400000"/>
<xsl:variable name="x_ges" select="$x_rw*$x_count"/>
<xsl:variable name="x_ges1" select="$x_format - $x_ges"/>
<xsl:variable name="x_ges2" select="$x_ges1 div $x_count"/>
<xsl:value-of select="$x_sum"/>
</xsl:template>
Code: Select all
(...)
<gml:pos>3480252.383 5889479.27</gml:pos>
<gml:pos>3480289.585 5889464.571</gml:pos>
(...)
Maybe somebody could give me a tip..
cheers
andy