A Guy at IBM wrote an excellent article, with sample on doing just that .
It uses Java extensions. See
http://www-106.ibm.com/developerworks/education/transforming-xml/xmltosvg/



                                                                                     
                    Mark                                                             
                    <mark@inomial.       To:     [EMAIL PROTECTED]              
                    com>                 cc:                                         
                                         Subject:     OT(?): transcendental          
                    17/09/2001            functions in XSLT                          
                    01:28 AM                                                         
                    Please respond                                                   
                    to fop-dev                                                       
                                                                                     
                                                                                     




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