Page 1 of 1

xquery math: functions in oxygen editor

Posted: Thu Dec 01, 2011 7:09 pm
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

Re: xquery math: functions in oxygen editor

Posted: Mon Dec 05, 2011 6:18 pm
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

Re: xquery math: functions in oxygen editor

Posted: Mon Dec 05, 2011 6:53 pm
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
};

Re: xquery math: functions in oxygen editor

Posted: Thu Jan 24, 2013 9:59 pm
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.