473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

firefox xslt math

Hi,
I am using an XSLT to generate an SVG client-side in Firefox. The user
opens an XML file in Firefox and sees a display.

In doing so, I have to convert from cartesian to polar coordinates, so I
need the sine and cosine functions. Firefox does not seem to recognize
the math: extensions (not too surprising) so I am using a series
expansion of the sin(x) function on the interval 0-90 degrees and
mapping any other value, and the cos function, into this interval with
simple arithmetic to calculate on the full 360 deg range. I use four
terms to get the accuracy I need.

Is there a faster/simpler way, given the constraints of having to use
xslt 1.0 with no extensions, which seems to be the case? or... is there
some way of generating some scripting code in the xslt which would
allow me to access javascript (for example) and still achieve the
'automagic' effect of opening an xml and seeing an svg display?

cheers

shaun
Nov 18 '06 #1
7 2220
why not use MathML for math?

shaun roe wrote:
Hi,
I am using an XSLT to generate an SVG client-side in Firefox. The user
opens an XML file in Firefox and sees a display.

In doing so, I have to convert from cartesian to polar coordinates, so I
need the sine and cosine functions. Firefox does not seem to recognize
the math: extensions (not too surprising) so I am using a series
expansion of the sin(x) function on the interval 0-90 degrees and
mapping any other value, and the cos function, into this interval with
simple arithmetic to calculate on the full 360 deg range. I use four
terms to get the accuracy I need.

Is there a faster/simpler way, given the constraints of having to use
xslt 1.0 with no extensions, which seems to be the case? or... is there
some way of generating some scripting code in the xslt which would
allow me to access javascript (for example) and still achieve the
'automagic' effect of opening an xml and seeing an svg display?

cheers

shaun
Nov 18 '06 #2
In article <11**********************@h54g2000cwb.googlegroups .com>,
"Chris Chiasson" <ch************@gmail.comwrote:
why not use MathML for math?
Is there a faster/simpler way, given the constraints of having to use
xslt 1.0 with no extensions, which seems to be the case? or... is there
some way of generating some scripting code in the xslt which would
allow me to access javascript (for example) and still achieve the
'automagic' effect of opening an xml and seeing an svg display?

cheers

shaun
Maybe I'm wrong, but as I understand it, MathML provides a way for
capturing the meaning of a math expression in a standard way so it can
be represented in a browser, but provides no engine for the evaluation
of a math expression..?
Nov 18 '06 #3
whoops, I thought you were using SVG to draw equations and stuff

:-]

Doesn't SVG itself have ways to represent (and animate) things like
arcs and circles?

I know that Firefox is capable of making javascript manipulate SVG
images, but I don't know how to do it myself.

shaun roe wrote:
In article <11**********************@h54g2000cwb.googlegroups .com>,
"Chris Chiasson" <ch************@gmail.comwrote:
why not use MathML for math?
Is there a faster/simpler way, given the constraints of having to use
xslt 1.0 with no extensions, which seems to be the case? or... is there
some way of generating some scripting code in the xslt which would
allow me to access javascript (for example) and still achieve the
'automagic' effect of opening an xml and seeing an svg display?
>
cheers
>
shaun

Maybe I'm wrong, but as I understand it, MathML provides a way for
capturing the meaning of a math expression in a standard way so it can
be represented in a browser, but provides no engine for the evaluation
of a math expression..?
Nov 18 '06 #4
shaun roe wrote:
is there
some way of generating some scripting code in the xslt which would
allow me to access javascript (for example) and still achieve the
'automagic' effect of opening an xml and seeing an svg display?
No, Firefox does not support extension functions for XSLT that are
written with script.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 18 '06 #5
shaun roe wrote:
Maybe I'm wrong, but as I understand it, MathML provides a way for
capturing the meaning of a math expression in a standard way so it can
be represented in a browser, but provides no engine for the evaluation
of a math expression..?
I believe that's correct. MathML is just a way of representing a
formula; while one could certainly write an evaluator (or solver),
that's a separate feature from MathML rendering.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Nov 18 '06 #6
Is there a faster/simpler way, given the constraints of having to use
xslt 1.0 with no extensions, which seems to be the case?
This just isn't the kind of task XSLT is optimized for, and support for
extensions (and the details of them) are always optional/nonportable...
I suspect your series-expansion solution is in fact the fastest portable
solution you're going to come up with in XSLT itself.

I suppose you could the XSLT generate Javascript into the HTML it's
producing, and then let the browser execute that as a second pass. Feels
ugly/fragile to me, but then again Javascript always strikes me that way.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Nov 18 '06 #7
You could use the sin() and cos() implementations in FXSL -- however FXSL
uses a lot the xxx:node-set() function, which AFAIR Firefox XSLT hasn't
implemented.

At least, you could have a look at the code of the XSLT implementations and
read the following article, describing it:

An XSL Calculator: The Math Modules of FXSL

at:
http://fxsl.sourceforge.net/articles...alculator.html

Now the efficiency question -- a few days ago I performed an experiment
compairing FXSL sin() and cos() implementation to that of Math.Sin() and
Math.Cos() in .NET

Surprisingly and very contrary to the existing beliefs, FXSL's timings were
about the same and not greater than the timings for the .Net
implementations.

I was running the FXSL test code with Saxon J 8.7.3

Another conclusion that statements such as:

"This just isn't the kind of task XSLT is optimized for"

are very often wrong!
Cheers,
Dimitre Novatchev

"shaun roe" <sh*******@wanadoo.frwrote in message
news:sh*****************************@news.wanadoo. fr...
Hi,
I am using an XSLT to generate an SVG client-side in Firefox. The user
opens an XML file in Firefox and sees a display.

In doing so, I have to convert from cartesian to polar coordinates, so I
need the sine and cosine functions. Firefox does not seem to recognize
the math: extensions (not too surprising) so I am using a series
expansion of the sin(x) function on the interval 0-90 degrees and
mapping any other value, and the cos function, into this interval with
simple arithmetic to calculate on the full 360 deg range. I use four
terms to get the accuracy I need.

Is there a faster/simpler way, given the constraints of having to use
xslt 1.0 with no extensions, which seems to be the case? or... is there
some way of generating some scripting code in the xslt which would
allow me to access javascript (for example) and still achieve the
'automagic' effect of opening an xml and seeing an svg display?

cheers

shaun

Nov 18 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nicole Szymanski | last post by:
Hello, I am developing a XML application that uses XSLT in order to transform math lessons written in XML to XHTML. I write TEX equation between math tags, for instance : ...
0
by: Benjamin Jones | last post by:
I have been fighting a problem with writing an XSLT applet for several days now. The following code works in a command line application, and in the applet viewer for provided with IBM eclipse. ...
4
by: Schraalhans Keukenmeester | last post by:
I have no clue why below code (found it somewhere and altered it a wee bit to my needs) will run without problem in both IE and Mozilla FireFox 1.0 but in the latter it takes up close to 100% cpu....
14
by: David Blickstein | last post by:
I have some XML documents that I want to open in a web browser and be automatically translated to HTML via XSLT. I'm using an xml-stylesheet processing command in a file called "girml.xml". ...
3
by: zakhan | last post by:
I have an XSL file that uses hiveware_enkoder javascript to hide an email address. This is a snippet from the xsl file: <script type="text/javascript"> //&lt;!]&gt; </script> This renders...
4
by: simon.a.hulbert | last post by:
Hi, I'm trying to view the following xslt transformation using firefox <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" > <xsl:output method = "xml" indent =...
7
by: Zzzbla | last post by:
Hi all, anyone has a live example of loading an xml file from a server, an xslt file from the server, then transforming the xml using the xslt and outputing the results (preferably with...
6
by: Dennis | last post by:
I am in the process of converting some program output from HTML to XML/XSLT. I have an XSL stylesheet that inserts some javascript in the output that gets called further down to pop up a window)....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.