If you are using xalan, you can add the
xmlns:math="xalan://java.lang.Math namespace
to your xsl document. Then you can use all
methods out of the java.lang.Math object.

<line x1="{math:log(myTag)}" y1="0" x2="{math:log(myTag)}" y2="0"/>

Although I haven't tried, I think this should also be possible in a  svg
path construction like

<path d="M275,175 v-150 a150,150 0 0,0 -{150 * math:sin(myTag)},{150 -
 fill="yellow" stroke="blue" stroke-width="5" />

Please keep me posted of your results.

Wim BeliŽn
Netherlands Institute of Applied Geoscience TNO
Delft, the Netherlands
tel     : +31 15 2696824

----- Original Message -----
From: "Mark" <[EMAIL PROTECTED]>
Sent: Sunday, September 16, 2001 5:28 PM
Subject: OT(?): transcendental functions in XSLT

> Hi folks,
> sorry for this slightly off topic post but i was hoping someone could
> help me.
> I thought i should be able to produce a very simple xml schema for
> generating pie charts. the idea was that I could use XSLT to transform
> from the pie-chart schema to SVG (and then to import the SVG into FOP).
> It would be preferable to express the size of the pie chart segments as
> percentages, but the SVG Path object requires coordinates on the
> circumferance of a circle.
> The problem is that there don't seem to be any functions in XSLT or
> XPath that let me find the sin() or cosine() of an angle. Am I missing
> something? I thought I could possibly use a transform but I can't seem
> to perform a transform in the middle of a Path.
> I finally decided that maybe if I created a table of degree-to-sin/cos
> mappings I could somehow use the document() function to import this into
> the stylesheet and use an index to search it (ergh) but that doesn't
> seem to work either.
> There's little point in having a pie-chart schema if you have to do the
> calculations yourself anyway.
> So if anyone has any suggestions .. ? I'd certainly be pleased to share
> a pie-chart-XSLT transform if I can get it going.
> As an aside, does anyone know why SVG paths are so (IMHO) brain dead? I
> can't believe that the elements in a path aren't XML elements, it seems
> very strange. (Generating the paths in XSLT is going to be a bit
> painful, even if I can get the sin() of an angle. I dont really see how
> "M300,200 h-150 a150,150 0 1,0 150,-150 z" qualifies as XML).
> Cheers
> Mark
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to