W3C home > Mailing lists > Public > www-math@w3.org > May 2007

RE: Trignametric functions in xsl

From: Robert Miner <robertm@dessci.com>
Date: Tue, 15 May 2007 09:26:08 -0700
Message-ID: <D1EFB337111B674B8F1BE155B01C6DD601DBF5DB@franklin.corp.dessci>
To: "Shweta S R" <shweta.sr@sonata-software.com>
Cc: <www-math@w3.org>

Hi.

I see the problem.  The sin and cos functions in the MathML schema are
not hooked up to a calculation engine in XSL processors.  They could be,
of course, but they aren't part of XPath and no XSL processors I know of
extend XPath with mathematical functions such as sin and cos.

More formally, the XSL spec says that the value of the select attribute
on a <xsl:valueof> element must be an XPath Expr, and XPath only has a
very limited list of functions that can be applied to numbers, e.g.
round, mod, basic arithmetic, etc.

Depending on the accuracy you need, you could approximate sin and cos
with a few terms of their power series.  The basic arithmetic in XPath
is sufficient to calculate those approximations.

--Robert
 

Robert Miner
Director, New Product Development
w3C Math WG co-chair

Design Science, Inc.
140 Pine Avenue, 4th Floor
Long Beach, California  90802
USA
Tel:  (651) 223-2883
Fax:  (651) 292-0014
robertm@dessci.com
www.dessci.com
~ Makers of MathType, MathFlow, MathPlayer, WebEQ, Equation Editor,
TexAide ~


> -----Original Message-----
> From: Shweta S R [mailto:shweta.sr@sonata-software.com]
> Sent: Tuesday, May 15, 2007 1:26 AM
> To: Robert Miner
> Subject: RE: Trignametric functions in xsl
> 
> Hi Robert
> 
> I am working for a project called OpenXML PPT translator for
Microsoft.
> 
> Project details: We are developing a Addin for Office application
which
> will convert ODF schema of Presentation document to OpenXML schema of
> Presentation ML. This will provide facility to user to view or modify
> ODF presentation documents in Microsoft Office PowerPoint, and also
save
> the OpenXML presentation documents as ODF presentation documents using
> Microsoft Office PowerPoint.
> 
> Problem: During this xml trnansformation from one schema to other
using,
> we are facing problem in using trignametric function with xsl version
> 1.0 and .NET framework 2.0. Basically I want use the trignamertic
> function like sin and cos for calculation.
> 
> e.g during line translation, to calculate rotate factor the following
> formula is used.
> 
> <xsl:attribute name ="svg:x1">
> 
>         <xsl:value-of select ="$xCenter - math:cos($angle) * $cxBy2 +
> math:sin($angle) * $cyBy2"/>
> 
> </xsl:attribute>
> 
> Use of sin and cos will through an exception like "Cannot find the
> script or external object that implements prefix
> http://schemas.openxmlformats.org/officeDocument/2006/math"
> 
> Please help me in using sin and cos functions with xsl version 1.0 and
> .NET framework 2.0.
> 
>  Shweta
>  Sonata Software Limited
>  Bangalore
>  Cell - 9448867910
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Robert Miner [mailto:robertm@dessci.com]
> Sent: Monday, May 14, 2007 11:53 PM
> To: Shweta S R; www-math@w3.org
> Subject: RE: Trignametric functions in xsl
> 
> Can you give us details?  An example would be best.
> 
> --Robert
> 
> Robert Miner
> Director, New Product Development
> 
> Design Science, Inc.
> 140 Pine Avenue, 4th Floor
> Long Beach, California  90802
> USA
> Tel:  (651) 223-2883
> Fax:  (651) 292-0014
> robertm@dessci.com
> www.dessci.com
> ~ Makers of MathType, MathFlow, MathPlayer, WebEQ, Equation Editor,
> TexAide ~
> 
> 
> > -----Original Message-----
> > From: www-math-request@w3.org [mailto:www-math-request@w3.org] On
> Behalf
> > Of Shweta S R
> > Sent: Monday, May 14, 2007 8:24 AM
> > To: www-math@w3.org
> > Subject: Trignametric functions in xsl
> >
> > Dear sir
> >
> > Trignametric functions like sin and cos are not working with xsl
> > version="1.0".
> >
> > Please help us how to use sin and cos xsl(version 1.0)  files.
> >
> > Shweta
> > Sonata Software Limited
> > Bangalore
> > Cell - 9448867910
> >
> 
> 
> 
Received on Tuesday, 15 May 2007 16:26:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 20 February 2010 06:12:59 GMT