Hello,
I am trying to create a graph of my data using <svg> but in order to scale the y axis correctly I need to find the max of a series of numbers.
To do this I thought the best approach would be to use something like this:
Code:
<!-- Plot Bars -->
<xsl:variable name="maxY" as="xs:decimal" select="0"/>
<xsl:for ...>
...
<xsl:if test="@attr_1 >= $maxY">
<xsl:value-of select="$maxY = @attr_1"/>
</xsl:if>
...
</xsl:for>
<!-- Use maxY here to plot Y axis -->
But this does nothing, I'm left with 0, so I then thought:
Code:
<!-- Plot Bars -->
<xsl:variable name="maxY" as="xs:decimal" select="0"/>
<xsl:for ...>
...
<xsl:value-of select="$maxY = max($maxY, @attr_1)"/>
...
</xsl:for>
<!-- Use maxY here to plot Y axis -->
But this produces and error during compilation of : Required item type of second argument of max() is xs:string; supplied value has item type xs:decimal
My XSL is Schema aware so it knows that @attr_1 really is a xs:decimal so needless to say I am quite confused with this as the W3C docs imply that it will return the max of a series of comma limited entries!
So I would appreciate your thoughts on this please.
--
Bill