xquery math: functions in oxygen editor

Issues related to W3C XQuery.
cmcenearney
Posts: 6
Joined: Thu Dec 01, 2011 6:44 pm

xquery math: functions in oxygen editor

Post by cmcenearney »

Hi,
Does anyone know how to use math: functions in Editor?

I've got Saxon-EE checked, along with "Enable Xquery 1.1 support" but no luck.

Running XML Editor 12.2, build 2011053115

Many thanks,
Colin
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: xquery math: functions in oxygen editor

Post by sorin_ristache »

Hello,

Saxon has a limited set of mathematical functions available for XQuery processing. Please look at the following example of using the sin function:

Code: Select all

xquery version "1.0";
declare namespace math="http://www.w3.org/2005/xpath-functions/math";
<test>
{math:sin(1)}
</test>

Regards,
Sorin
cmcenearney
Posts: 6
Joined: Thu Dec 01, 2011 6:44 pm

Re: xquery math: functions in oxygen editor

Post by cmcenearney »

Thanks!

I was hoping to use math:pow, so that's too bad, but great to know about this resource.

And I guess creating a function for this is good for my brain anyway.

declare function local:exponentiate
($base as xs:double?, $power as xs:double?) as xs:double?
{
if ($power gt 1)
then $base * (local:exponentiate(($base),($power - 1)))
else $base
};
wvision70
Posts: 1
Joined: Thu Jan 24, 2013 9:50 pm

Re: xquery math: functions in oxygen editor

Post by wvision70 »

For the records : finally with XPath 3.0 the math:pow(x,n) function is supported in Oxygen using the Saxon 9.4 processor, as well as other trig math functions.

You can test it in the XPath toolbar.

http://www.w3.org/TR/xslt-30/

Best Regards,
Andy.
Post Reply