xsl-list
[Top] [All Lists]

Frustration High

2004-06-02 10:48:40
Hey Guys,

I am trying to create a pie chart in svg from a very simple xml file. When I
try to create the file I get...

file:/C:/Documents and Settings/Chris/My Documents/EyeStreet/Mockup/Rev2/XSL
Files/CreatePie.xslt; Line #54; Column #-1; XSLT Error
(javax.xml.transform.TransformerException):
javax.xml.transform.TransformerException: java.lang.ClassNotFoun
dException: java/java/lang/Math

Here is part of the code...

<xsl:template match="SITE">
                <xsl:param name="color" select="'indianRed'"/>
                <xsl:param name="total" select="'0'"/>
                <xsl:param name="runningTotal" select="'0'"/>
                <xsl:variable name="number" select="."/>
                <xsl:variable name="currentAngle"
select="java:java.lang.Math.toRadians(($number div $total) * 360.0)"/>
                <xsl:variable name="halfAngle"
select="java:java.lang.Math.toRadians((($number div 2) div $total) *
360.0)"/>
                <xsl:variable name="rotation" select="270 + (360.0 *
($runningTotal div $total))"/>
                <xsl:variable name="x1"
select="java:java.lang.Math.cos($halfAngle) * 70"/>
                <xsl:variable name="y1"
select="java:java.lang.Math.sin($halfAngle) * 70"/>
                <xsl:variable name="cosTheta"
select="java:java.lang.Math.cos(java:java.lang.Math.toRadians($rotation))"/>
                <xsl:variable name="sinTheta"
select="java:java.lang.Math.sin(java:java.lang.Math.toRadians($rotation))"/>
                <path style="fill:{$color};stroke:black;stroke-width:1;
          fillrule:evenodd;stroke-linejoin:bevel;">
                        <xsl:attribute
name="transform"><xsl:text>translate(150,150)</xsl:text><!--centering the
circle in the non-legend space--><xsl:text>rotate(</xsl:text><xsl:value-of
select="$rotation"/><xsl:text>)</xsl:text></xsl:attribute>
                        <xsl:attribute name="d"><xsl:text>M 100 0 A 100 100
0 </xsl:text><!-- to change size, change all instances of
100--><xsl:choose><xsl:when test="$currentAngle > 3.14"><xsl:text>1
</xsl:text></xsl:when><xsl:otherwise><xsl:text>0
</xsl:text></xsl:otherwise></xsl:choose><xsl:text>1 </xsl:text><xsl:value-of
select="java:java.lang.Math.cos($currentAngle) * 100"/><xsl:text>
</xsl:text><xsl:value-of select="java:java.lang.Math.sin($currentAngle) *
100"/><xsl:text> L 0 0 Z</xsl:text></xsl:attribute>
                </path>
                <text style="text-anchor:middle">
                        <xsl:attribute
name="transform"><xsl:text>translate(150,150) </xsl:text></xsl:attribute>
                        <xsl:attribute name="x"><xsl:value-of select="($x1 *
$cosTheta) - ($y1 * $sinTheta)"/></xsl:attribute>
                        <xsl:attribute name="y"><xsl:value-of select="($x1 *
$sinTheta) + ($y1 * $cosTheta)"/></xsl:attribute>
                        <xsl:value-of select="round(100 * ($number div
$total))"/>
                        <xsl:text>%</xsl:text>
                </text>
        </xsl:template>

#######################################

It seems to me that this is a problem with Java paths, but I can't seem to
get it figured out. Any help would be appreciated.

Thanks

Chris




<Prev in Thread] Current Thread [Next in Thread>