xsl-list
[Top] [All Lists]

RE: Frustration High (Possible path problems?)

2004-06-02 12:29:19
This is an xalan specific question, they have a mailing list here: 
http://xml.apache.org/mail.html

It's usually better to start simple to start tracking things down. Since you 
didn't include the stylesheet element I can't be sure, but I'm betting that you 
declared the java namespace incorrectly. 

The xsl below works, but if I change the xmlns:java to "frog" I get: 

java.lang.ClassNotFoundException: frog.java.lang.Math
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)


<?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
    xmlns:java="http://xml.apache.org/xalan/java";>
  <xsl:output method="xml" encoding="UTF-8" indent="yes"/>

  <xsl:template match="/">
    <three><xsl:value-of select="java:java.lang.Math.floor(3.14)"/></three>
  </xsl:template>

</xsl:stylesheet>

Josh

-----Original Message-----
From: Christopher Jacob [mailto:chris(_dot_)jacob(_at_)eyestreet(_dot_)com]
Sent: Wednesday, June 02, 2004 11:51 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Frustration High (Possible path problems?)


I am using xalan


-----Original Message-----
From: Michael Kay [mailto:mhk(_at_)mhk(_dot_)me(_dot_)uk] 
Sent: Wednesday, June 02, 2004 1:58 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Frustration High

Extension functions depend on which processor you are using, so that's the
first thing you should tell us.

It's also possible of course that you aren't using the processor you think
you are...

Michael Kay 

-----Original Message-----
From: Christopher Jacob [mailto:chris(_dot_)jacob(_at_)eyestreet(_dot_)com] 
Sent: 02 June 2004 17:49
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Frustration High

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><!--ce
ntering 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



--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



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