diff -Nru zorba-excel-module-2.9.1/debian/bzr-builder.manifest zorba-excel-module-3.0.0/debian/bzr-builder.manifest --- zorba-excel-module-2.9.1/debian/bzr-builder.manifest 2013-05-30 16:28:51.000000000 +0000 +++ zorba-excel-module-3.0.0/debian/bzr-builder.manifest 2013-11-07 17:11:05.000000000 +0000 @@ -1,3 +1,3 @@ -# bzr-builder format 0.3 deb-version {debupstream}-0 -lp:zorba/excel-module revid:william.candillon@28msec.com-20120928140500-u5055ohwaly6ehj7 -nest-part debian_rules lp:~zorba-coders/zorba/debian_control_files debian_files/zorba-excel-module_debian_rules/debian debian revid:juan457@gmail.com-20130529150701-m2co1uzthg4pkjy5 +# bzr-builder format 0.3 deb-version 3.0.0-0 +lp:zorba/excel-module revid:jenkins@lambda.nu-20130823150140-uq3fgo12ekbb3hg0 +nest-part debian_rules lp:~zorba-coders/zorba/debian_control_files debian_files/zorba-excel-module_debian_rules/debian debian revid:juan457@gmail.com-20131031190552-9p76o0q432489tw2 diff -Nru zorba-excel-module-2.9.1/debian/changelog zorba-excel-module-3.0.0/debian/changelog --- zorba-excel-module-2.9.1/debian/changelog 2013-05-30 16:28:51.000000000 +0000 +++ zorba-excel-module-3.0.0/debian/changelog 2013-11-07 17:11:05.000000000 +0000 @@ -1,12 +1,6 @@ -zorba-excel-module (2.9.1-0~saucy1) saucy; urgency=low +zorba-excel-module (3.0.0-0~ubuntu13.10.1) saucy; urgency=low * Auto build. - -- Juan Zacarias Thu, 30 May 2013 16:28:51 +0000 - -zorba-excel-module (2.9.1) unstable; urgency=low - - *Updated to current Version - - -- Juan Zacarias Wed, 29 May 2013 08:06:37 -0700 + -- Juan Zacarias Thu, 07 Nov 2013 17:11:05 +0000 diff -Nru zorba-excel-module-2.9.1/debian/copyright zorba-excel-module-3.0.0/debian/copyright --- zorba-excel-module-2.9.1/debian/copyright 2013-05-30 16:28:50.000000000 +0000 +++ zorba-excel-module-3.0.0/debian/copyright 2013-11-07 17:11:05.000000000 +0000 @@ -1,5 +1,4 @@ This package was debianized by Juan Zacarias on -Wed, 29 May 2013 08:06:37 -0700 It was downloaded from http://www.zorba-xquery.com diff -Nru zorba-excel-module-2.9.1/src/CMakeLists.txt zorba-excel-module-3.0.0/src/CMakeLists.txt --- zorba-excel-module-2.9.1/src/CMakeLists.txt 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/CMakeLists.txt 2013-11-07 17:11:01.000000000 +0000 @@ -12,8 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -# all external module libraries are generated in the directory -# of the corresponding .xq file -MESSAGE(STATUS "Add com") -ADD_SUBDIRECTORY(com) -MESSAGE(STATUS "End modules") +DECLARE_ZORBA_MODULE (URI "http://zorba.io/modules/excel/datetime" VERSION 1.0 FILE "datetime.xq") +DECLARE_ZORBA_MODULE (URI "http://zorba.io/modules/excel/engineering" VERSION 1.0 FILE "engineering.xq") +DECLARE_ZORBA_MODULE (URI "http://zorba.io/modules/excel/information" VERSION 1.0 FILE "information.xq") +DECLARE_ZORBA_MODULE (URI "http://zorba.io/modules/excel/logical" VERSION 1.0 FILE "logical.xq") +DECLARE_ZORBA_MODULE (URI "http://zorba.io/modules/excel/lookup" VERSION 1.0 FILE "lookup.xq") +DECLARE_ZORBA_MODULE (URI "http://zorba.io/modules/excel/math-sumproduct" VERSION 1.0 FILE "math-sumproduct.xq") +DECLARE_ZORBA_MODULE (URI "http://zorba.io/modules/excel/math" VERSION 1.0 FILE "math.xq") +DECLARE_ZORBA_MODULE (URI "http://zorba.io/modules/excel/statistical-zorba" VERSION 1.0 FILE "statistical-zorba.xq") +DECLARE_ZORBA_MODULE (URI "http://zorba.io/modules/excel/statistical" VERSION 1.0 FILE "statistical.xq") +DECLARE_ZORBA_MODULE(URI "http://zorba.io/modules/excel/text" VERSION 1.0 FILE "text.xq") diff -Nru zorba-excel-module-2.9.1/src/com/CMakeLists.txt zorba-excel-module-3.0.0/src/com/CMakeLists.txt --- zorba-excel-module-2.9.1/src/com/CMakeLists.txt 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Copyright 2006-2008 The FLWOR Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ADD_SUBDIRECTORY(zorba-xquery) diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/CMakeLists.txt zorba-excel-module-3.0.0/src/com/zorba-xquery/CMakeLists.txt --- zorba-excel-module-2.9.1/src/com/zorba-xquery/CMakeLists.txt 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Copyright 2006-2008 The FLWOR Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ADD_SUBDIRECTORY(www) diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/CMakeLists.txt zorba-excel-module-3.0.0/src/com/zorba-xquery/www/CMakeLists.txt --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/CMakeLists.txt 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Copyright 2006-2008 The FLWOR Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ADD_SUBDIRECTORY(modules) diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/CMakeLists.txt zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/CMakeLists.txt --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/CMakeLists.txt 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Copyright 2006-2008 The FLWOR Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ADD_SUBDIRECTORY(excel) diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/CMakeLists.txt zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/CMakeLists.txt --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/CMakeLists.txt 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -# Copyright 2006-2008 The FLWOR Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/excel/datetime" VERSION 1.0 FILE "datetime.xq") -DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/excel/engineering" VERSION 1.0 FILE "engineering.xq") -DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/excel/information" VERSION 1.0 FILE "information.xq") -DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/excel/logical" VERSION 1.0 FILE "logical.xq") -DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/excel/lookup" VERSION 1.0 FILE "lookup.xq") -DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/excel/math-sumproduct" VERSION 1.0 FILE "math-sumproduct.xq") -DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/excel/math" VERSION 1.0 FILE "math.xq") -DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/excel/statistical-zorba" VERSION 1.0 FILE "statistical-zorba.xq") -DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/excel/statistical" VERSION 1.0 FILE "statistical.xq") -DECLARE_ZORBA_MODULE(URI "http://www.zorba-xquery.com/modules/excel/text" VERSION 1.0 FILE "text.xq") diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/datetime.xq zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/datetime.xq --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/datetime.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/datetime.xq 1970-01-01 00:00:00.000000000 +0000 @@ -1,383 +0,0 @@ -xquery version "3.0"; - -(: - : Copyright 2006-2009 The FLWOR Foundation. - : - : Licensed under the Apache License, Version 2.0 (the "License"); - : you may not use this file except in compliance with the License. - : You may obtain a copy of the License at - : - : http://www.apache.org/licenses/LICENSE-2.0 - : - : Unless required by applicable law or agreed to in writing, software - : distributed under the License is distributed on an "AS IS" BASIS, - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - : See the License for the specific language governing permissions and - : limitations under the License. -:) - -(:~ - : This is a library module offering the same set of functions - : defined by Microsoft Excel. - : - : @see Excel Documentation: Datetime Functions - : - : @author Sorin Nasoi - : @project Zorba/Excel/Datetime - : - :) -module namespace excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime" ; - -declare namespace excel-err = "http://www.zorba-xquery.com/modules/excel/errors"; - -(:~ - : Import excel-text module functions. - :) -import module namespace excel-text = "http://www.zorba-xquery.com/modules/excel/text"; - -declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; -declare option ver:module-version "1.0"; - -(:~ - : The day of the week, from a date. - : - : @param $date the date. - : @return the day of the week as a number, where from 0 (Sunday) to 6 (Saturday). - :) -declare %private function excel-datetime:day-of-week - ( $date as xs:anyAtomicType? ) as xs:integer? { - - if (fn:empty($date)) - then () - else xs:integer((xs:date($date) - xs:date('1899-01-01')) - div xs:dayTimeDuration('P1D')) mod 7 - } ; - -(:~ - : Tests if a year is leap or not. - : - : @param $date the date. - : @return true if the year part of the supplied $date is a leap year, false otherwise. - :) -declare %private function excel-datetime:is-leap-year - ( $date as xs:date ) as xs:boolean { - - let $year := fn:year-from-date($date) - return (($year mod 4 = 0 and $year mod 100 != 0) or - ($year mod 400 = 0)) - } ; - -(: actual requirements :) -(:~ - : Returns the number of days between two dates based on a 360-day year. - : - : @see http://office.microsoft.com/en-us/excel/HP052090471033.aspx - : @param $start_date the start date. - : @param $end_date the end date. - : @return The number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations.
- : Use this function to help compute payments if your accounting system is based on twelve 30-day months.
- : The metod used is U.S. (NASD). If the starting date is the last day of a month, it becomes equal to the 30th of the same month.
- : If the ending date is the last day of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month; otherwise the ending date becomes equal to the 30th of the same month. - :) -declare function excel-datetime:days360 - ( $start_date as xs:date, - $end_date as xs:date) as xs:integer { - - excel-datetime:days360($start_date, $end_date, fn:false()) - } ; - -(:~ - : Returns the number of days between two dates based on a 360-day year. - : - : @see http://office.microsoft.com/en-us/excel/HP052090471033.aspx - : @param $start_date the start date. - : @param $end_date the end date. - : @param $method if false then US/NASD Method is used, otherwise the European Method is used. - : @return The number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations. - : Use this function to help compute payments if your accounting system is based on twelve 30-day months.
- :The European Method (30E/360)
- : - If either date A or B falls on the 31st of the month, that date will be changed to the 30th;
- : - Where date B falls on the last day of February, the actual date B will be used.

- : - :The US/NASD Method (30US/360)
- : - If both date A and B fall on the last day of February, then date B will be changed to the 30th.
- : - If date A falls on the 31st of a month or last day of February, then date A will be changed to the 30th.
- : - If date A falls on the 30th of a month after applying (2) above and date B falls on the 31st of a month, then date B will be changed to the 30th. - :) -declare function excel-datetime:days360 - ( $start_date as xs:date, - $end_date as xs:date, - $method as xs:boolean) as xs:integer { - - if($method eq fn:true()) then (: European Method :) - let $sd := if (fn:day-from-date($start_date) eq 31) then - excel-datetime:date(fn:year-from-date($start_date), fn:month-from-date($start_date), 30) - else $start_date - - let $ed := if (fn:day-from-date($end_date) eq 31) then - excel-datetime:date(fn:year-from-date($end_date), fn:month-from-date($end_date), 30) - else $end_date - - let $ed1 := excel-datetime:date(fn:year-from-date($ed), fn:month-from-date($ed), 01) - - let $ret := fn:days-from-duration($ed1 - $sd)+ fn:day-from-date($ed) - return if($ret < 0) then $ret else $ret - 1 - else (: US/NASD Method :) - let $ed := if(($start_date = $end_date) and - ((excel-datetime:is-leap-year($end_date) and (fn:day-from-date($end_date) eq 29)) or - (fn:day-from-date($end_date) eq 28))) then - excel-datetime:date(fn:year-from-date($end_date), fn:month-from-date($end_date), 30) - else $end_date - - return if((fn:day-from-date($start_date) eq 31) or - ((excel-datetime:is-leap-year($start_date) and (fn:day-from-date($start_date) eq 29)) or - (fn:day-from-date($start_date) eq 28))) then - let $sd := excel-datetime:date(fn:year-from-date($start_date), fn:month-from-date($start_date), 30) - let $ed := if (fn:day-from-date($ed) eq 31) then - excel-datetime:date(fn:year-from-date($ed), fn:month-from-date($ed), 30) else - $ed - let $ed1 := excel-datetime:date(fn:year-from-date($ed), fn:month-from-date($ed), 01) - let $ret := fn:days-from-duration($ed1 - $sd)+ fn:day-from-date($ed) - 1 - return if($ret < 0) then $ret else $ret - 1 - else - let $ed1 := excel-datetime:date(fn:year-from-date($ed), fn:month-from-date($ed), 01) - let $ret := fn:days-from-duration($ed1 - $start_date)+ fn:day-from-date($ed) - return if($ret < 0) then $ret else $ret - 1 - } ; - -(:~ - : Returns the hour of a time value. - : - : @see http://office.microsoft.com/en-us/excel/HP052091151033.aspx - : @param $time the time. - : @return The hour of a time value. The hour is as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.). - :) -declare function excel-datetime:hour - ($time as xs:time) as xs:integer? { - - fn:hours-from-time($time) - }; - -(:~ - : Returns the minutes of a time value. - : - : @see http://office.microsoft.com/en-us/excel/HP052091781033.aspx - : @param $time the time. - : @return The minutes of a time value. The minute is given as an integer, ranging from 0 to 59. - :) -declare function excel-datetime:minute - ($time as xs:time) as xs:integer? { - - fn:minutes-from-time($time) - }; - -(:~ - : Returns the month of a $date. - : - : @see http://office.microsoft.com/en-us/excel/HP052091841033.aspx - : @param $date the date. - : @return the month of a $date. The month is given as an integer, ranging from 1 (January) to 12 (December). - :) -declare function excel-datetime:month - ($date as xs:date) as xs:integer? { - - fn:month-from-date($date) - }; - -(:~ - : Returns the seconds of a $time value. - : - : @see http://office.microsoft.com/en-us/excel/HP052092511033.aspx - : @param $time the time. - : @return The seconds of a $time value. The second is given as an integer in the range 0 (zero) to 59. - :) -declare function excel-datetime:second - ($time as xs:time) as xs:decimal ? { - - fn:seconds-from-time($time) - }; - -(:~ - : Returns the day of a $date, represented by a serial number. - : - : @see http://office.microsoft.com/en-us/excel/HP052090461033.aspx - : @param $date the date. - : @return The day of a $date, represented by a serial number. The day is given as an integer ranging from 1 to 31. - :) -declare function excel-datetime:day - ($date as xs:date) as xs:integer? { - - fn:day-from-date($date) - }; - -(:~ - : Returns the year corresponding to a date. - : - : @see http://office.microsoft.com/en-us/excel/HP052093431033.aspx - : @param $date the date. - : @return The year corresponding to a date. - :) -declare function excel-datetime:year - ($date as xs:date) as xs:integer? { - - fn:year-from-date($date) - }; - -(:~ - : Returns the current date. - : - : @see http://www.w3.org/TR/xquery-operators/#func-current-date - : @return The current date. - :) -declare function excel-datetime:today - () as xs:date? { - - fn:current-date() - }; - -(:~ - : Returns the current date and time. - : - : @see http://www.w3.org/TR/xquery-operators/#func-current-dateTime - : @return The current date and time. - :) -declare function excel-datetime:now - () as xs:dateTime? { - - fn:current-dateTime() - }; - -(:~ - : Constructs a date given the hours, months and days. - TODO what happens when the params are not in range - : - : @see http://office.microsoft.com/en-us/excel/HP052090421033.aspxs - : @param $year the year - : @param $month the month - : @param $day the day - : @return A date given the hours, months and days - :) -declare function excel-datetime:date - ($year as xs:integer, - $month as xs:integer, - $day as xs:integer) as xs:date? { - - let $vyear := excel-text:pad-integer-to-length($year, "0", 4) - let $vmonth := excel-text:pad-integer-to-length($month, "0", 2) - let $vday := excel-text:pad-integer-to-length($day, "0", 2) - - return xs:date(fn:string-join(($vyear, $vmonth, $vday),"-")) - }; - -(: TODO what happens when the params are not in range :) -(:~ - : Constructs a time given the hours, minutes and seconds. - : - : @see http://office.microsoft.com/en-us/excel/HP052093151033.aspx - : @param $hour the hour. - : @param $minute the minute. - : @param $second the second. - : @return A time given the hours, minutes and seconds. - :) -declare function excel-datetime:time - ($hour as xs:integer, - $minute as xs:integer, - $second as xs:integer) as xs:time? { - - let $vhour := excel-text:pad-integer-to-length($hour, "0",2) - let $vminute := excel-text:pad-integer-to-length($minute, "0",2) - let $vsecond := excel-text:pad-integer-to-length($second, "0",2) - - return xs:time(fn:string-join(($vhour, $vminute,$vsecond),":")) - }; - -(:~ - : Returns the day of the week corresponding to a $date. - : - : @see http://office.microsoft.com/en-us/excel/HP052093151033.aspx - : @param $date the date. - : @return The day of the week corresponding to a $date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday). - :) -declare function excel-datetime:weekday - ($date as xs:date) as xs:integer? { - - excel-datetime:weekday($date, 1) -}; - -(:~ - : Returns the day of the week corresponding to a $date depending on $return_type. - : - : @see http://office.microsoft.com/en-us/excel/HP052093361033.aspx - : @param $date the date. - : @param $return_type 1 for Numbers 1 (Sunday) through 7 (Saturday). 2 for Numbers 1 (Monday) through 7 (Sunday). 3 for Numbers 0 (Monday) through 6 (Sunday). - : @error excel-err:Value if $return_type is outside the range [1,3]. - : @return The day of the week corresponding to a $date depending on $return_type. - :) -declare function excel-datetime:weekday - ($date as xs:date, - $return_type as xs:integer) as xs:integer? { - - if ($return_type eq 1) then - excel-datetime:day-of-week($date) + 1 - else if ($return_type eq 2) then - if (excel-datetime:day-of-week($date) eq 0) then 7 - else excel-datetime:day-of-week($date) - else if ($return_type eq 3) then - if(excel-datetime:day-of-week($date) eq 0) then 6 - else excel-datetime:day-of-week($date) - 1 - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided number must be in range [1,3]", $return_type) -}; - -(:~ - : Returns the number of whole working days between $start_date and $end_date. - : - : @see http://office.microsoft.com/en-us/excel/HP052091901033.aspx - : @param $start_date the start date. - : @param $end_date the end date. - : @return The number of whole working days between start_date and end_date.
- : Working days exclude weekends and any dates identified in holidays.
- : Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term. - :) -declare function excel-datetime:networkdays - ($start_date as xs:date, - $end_date as xs:date) as xs:integer* { - - excel-datetime:networkdays( $start_date, $end_date, ()) -}; - -(:~ - : Returns the number of whole working days between $start_date and $end_date. - : - : @see http://office.microsoft.com/en-us/excel/HP052091901033.aspx - : @param $start_date the start date. - : @param $end_date the end date. - : @param $holidays one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays. - : @return The number of whole working days between start_date and end_date.
- : Working days exclude weekends and any dates identified in holidays.
- : Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term. - :) -declare function excel-datetime:networkdays - ($start_date as xs:date, - $end_date as xs:date, - $holidays as xs:date*) as xs:integer* { - - let $days := fn:days-from-duration($end_date - $start_date) + 1 - - let $before := 8 - excel-datetime:day-of-week($start_date) - let $after := excel-datetime:day-of-week($end_date) - - let $working_days := (($days - $before - $after) idiv 7 )*5 - + (if(excel-datetime:day-of-week($start_date) < 7) then 6 - excel-datetime:day-of-week($start_date) else 0) - + (if($after < 6) then $after else if($after eq 6) then 5 else 0) - - let $hol := fn:count( for $date in $holidays - return if(($start_date lt $date) and - ($date lt $end_date) and - (excel-datetime:day-of-week($date) ne 6) and - (excel-datetime:day-of-week($date) ne 0)) then 1 - else ()) - - return $working_days - $hol -}; diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/engineering.xq zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/engineering.xq --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/engineering.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/engineering.xq 1970-01-01 00:00:00.000000000 +0000 @@ -1,728 +0,0 @@ -xquery version "3.0"; - -(: - : Copyright 2006-2009 The FLWOR Foundation. - : - : Licensed under the Apache License, Version 2.0 (the "License"); - : you may not use this file except in compliance with the License. - : You may obtain a copy of the License at - : - : http://www.apache.org/licenses/LICENSE-2.0 - : - : Unless required by applicable law or agreed to in writing, software - : distributed under the License is distributed on an "AS IS" BASIS, - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - : See the License for the specific language governing permissions and - : limitations under the License. -:) - -(:~ - : This is a library module offering the same set of functions - : defined by Microsoft Excel, under Engineering Functions. - : - : @author Sorin Nasoi - : - : @see Excel Documentation: Engineering Functions - : - : @project Zorba/Excel/Engineering - :) -module namespace excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering" ; - -declare namespace excel-err = "http://www.zorba-xquery.com/modules/excel/errors"; - -(:~ - : Import excel-text module functions. - :) -import module namespace excel-text="http://www.zorba-xquery.com/modules/excel/text"; - -(:~ - : Import excel-math module functions. - :) -import module namespace excel-math="http://www.zorba-xquery.com/modules/excel/math"; - -declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; -declare option ver:module-version "1.0"; - -(:~ - : Tests if a string is a hexadecimal representation of a number. - : - : @param $arg the string. - : @return True if the passed $arg is a hexadecimal number, false otherwise. - :) -declare %private function excel-engineering:is-hex - ($arg as xs:string) as xs:boolean { - - let $tmp := fn:upper-case($arg) - let $hexCP:=(48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70) - - return if (fn:exists(excel-text:value-except(fn:string-to-codepoints($tmp),($hexCP)))) then fn:false() - else fn:true() -}; - -(:~ - : Tests if a string is a octal representation of a number. - : - : @param $arg the string - : @return True if the passed $arg is a octal number, false otherwise. - :) -declare %private function excel-engineering:is-oct - ($arg as xs:string) as xs:boolean { - - let $octCP:=(48, 49, 50, 51, 52, 53, 54, 55) - - return if (fn:exists(excel-text:value-except(fn:string-to-codepoints($arg),($octCP)))) then fn:false() - else fn:true() -}; - -(:~ - : Tests if a string is a binary representation of a number. - : - : @param $arg the string. - : @return True if the passed $arg is a binary number, false otherwise. - :) -declare %private function excel-engineering:is-bin - ($arg as xs:string) as xs:boolean { - - let $binCP:=(48, 49) - - return if (fn:exists(excel-text:value-except(fn:string-to-codepoints($arg),($binCP)))) then fn:false() - else fn:true() -}; - -(:~ - : Returns a binary representation of a number. - : - : @param $number the number. - : @error excel-err:Value if provided value for $number is not numeric. - : @return A binary representation of a number. - :) -declare %private function excel-engineering:dec2hexUtil - ($number as xs:anyAtomicType) as xs:string { - - if (fn:not(excel-math:is-a-number($number))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $number) - else - let $tmpNumber := xs:integer($number) - - let $hexDigits:=('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F') - return - if($number < 16) then - $hexDigits[$number + 1] - else - fn:concat(excel-engineering:dec2hex($number idiv 16), excel-engineering:dec2hex($number mod 16)) -}; - -(:~ - : Returns an octal representation of a number. - : - : @param $number the number. - : @error excel-err:Value if provided value for $number is not numeric. - : @return An octal representation of a number. - :) -declare %private function excel-engineering:dec2octUtil - ($number as xs:anyAtomicType) as xs:string { - - if (fn:not(excel-math:is-a-number($number))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $number) - else - let $tmpNumber := xs:integer($number) - - let $octDigits:=('0', '1', '2', '3', '4', '5', '6', '7') - return - if($number < 8) then - $octDigits[$number + 1] - else - fn:concat(excel-engineering:dec2oct($number idiv 8), excel-engineering:dec2oct($number mod 8)) -}; - -(:~ - : Returns a binary representation of a number. - : - : @param $arg the number. - : @error excel-err:Value if provided value for $number is not numeric. - : @return A binary representation of a number. - :) -declare %private function excel-engineering:dec2binUtil - ($arg as xs:anyAtomicType) as xs:string { - - if (fn:not(excel-math:is-a-number($arg))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) - else - let $tmpNumber := xs:integer($arg) - - let $binDigits:=('0', '1') - return - if($tmpNumber < 2) then - $binDigits[$tmpNumber + 1] - else - fn:concat(excel-engineering:dec2binUtil($tmpNumber idiv 2), excel-engineering:dec2binUtil($tmpNumber mod 2)) -}; - -(:~ - : Returns a decimal representation of a number given it's hexadecimal representation. - : - : @param $arg the number. - : @error excel-err:Value if provided $arg is not a hexadecimal representation of a number. - : @return A decimal representation of a number given it's hexadecimal representation. - :) -declare %private function excel-engineering:hex2decUtil - ($arg as xs:string) as xs:integer* { - - let $number := fn:upper-case($arg) - let $hexCP := (48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70) - - return if (fn:not(excel-engineering:is-hex($number))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided string is not a hexadecimal representation of a number", $number) - else - let $tmp := fn:reverse(fn:string-to-codepoints($number)) - return fn:sum(for $val in (0 to fn:string-length($number)-1) - return (fn:index-of($hexCP, $tmp[$val + 1]) - 1) * excel-math:power(16, $val)) -}; - -(:~ - : Returns a decimal representation of a number given it's octal representation. - : - : @param $arg the number. - : @error excel-err:Value if provided $arg is not an octal representation of a number. - : @return A decimal representation of a number given it's octal representation. - :) -declare %private function excel-engineering:oct2decUtil - ($arg as xs:string) as xs:integer { - - if (fn:not(excel-engineering:is-oct($arg))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided string is not an octal representation of a number", $arg) - else - let $tmp := fn:reverse(fn:string-to-codepoints($arg)) - return fn:sum(for $val in (0 to fn:string-length($arg)-1) - return xs:integer(fn:codepoints-to-string($tmp[$val + 1])) * excel-math:power(8, $val)) -}; - -(:~ - : Returns a decimal representation of a number given it's binary representation. - : - : @param $arg the number. - : @error excel-err:Value if provided $arg is not an binary representation of a number. - : @return A decimal representation of a number given it's binary representation. - :) -declare %private function excel-engineering:bin2decUtil - ($arg as xs:string) as xs:integer { - - if (fn:not(excel-engineering:is-bin($arg))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided string is not a binary representation of a number", $arg) - else - let $tmp := fn:reverse(fn:string-to-codepoints($arg)) - return fn:sum(for $val in (0 to fn:string-length($arg)-1) - return xs:integer(fn:codepoints-to-string($tmp[$val + 1])) * excel-math:power(2, $val)) -}; - -(:~ - : Converts a decimal number to hexadecimal. - : - : @see http://office.microsoft.com/en-us/excel/HP052090541033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not numeric. - : @error excel-err:Num if provided value for $arg is smaller than -549755813888 or bigger than 549755813887 - : @return A hexadecimal representation of a number given it's decimal representation. - :) -declare function excel-engineering:dec2hex - ($arg as xs:anyAtomicType) as xs:string { - - if (fn:not(excel-math:is-a-number($arg))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) - else - let $tmpNumber := xs:integer($arg) - - return - if(($tmpNumber < -549755813888) or ($tmpNumber > 549755813887)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -549755813888 or bigger than 549755813887", $tmpNumber) - else if($tmpNumber < 0) then - let $tmp := 1 + excel-engineering:hex2decUtil(fn:translate( - excel-text:pad-integer-to-length(excel-engineering:dec2hexUtil(fn:abs($tmpNumber)), "0", 10), - "0123456789ABCDEF", - "FEDCBA9876543210")) - return excel-engineering:dec2hexUtil($tmp) - else - excel-engineering:dec2hexUtil($tmpNumber) -}; - -(:~ - : Converts a decimal number to hexadecimal. - : - : @see http://office.microsoft.com/en-us/excel/HP052090541033.aspx?pid=CH062528241033 - : @param $arg the number. - : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). - : @error excel-err:Value if provided value for $arg is not numeric. - : @error excel-err:Value if provided value for $places is not numeric. - : @error excel-err:Num if provided value for $places is zero or negative. - : @error excel-err:Num if provided value for $places is too small. - : @error excel-err:Num if provided value for $arg is smaller than -549755813888 or bigger than 549755813887. - : @return A hexadecimal representation of a number given it's decimal representation. - :) -declare function excel-engineering:dec2hex - ($arg as xs:anyAtomicType, - $places as xs:anyAtomicType) as xs:string { - - if (fn:not(excel-math:is-a-number($arg))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) - else if(fn:not(excel-math:is-a-number($places))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'places' is not numeric", $places) - else - let $tmpNumber := xs:integer($arg) - let $tmpPlaces := xs:integer($places) - - return - if(($tmpNumber < -549755813888) or ($tmpNumber > 549755813887)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -549755813888 or bigger than 549755813887", $tmpNumber) - else if($tmpPlaces < 1) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' is zero or negative", $tmpPlaces) - else - if($tmpNumber < 0) then - let $tmp := 1 + excel-engineering:hex2decUtil(fn:translate( - excel-text:pad-integer-to-length(excel-engineering:dec2hexUtil(fn:abs($tmpNumber)), "0", 10), - "0123456789ABCDEF", - "FEDCBA9876543210")) - return excel-engineering:dec2hexUtil($tmp) - else - let $tmp := excel-engineering:dec2hexUtil($tmpNumber) - return if($tmpPlaces < fn:string-length($tmp)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' too small", $tmpPlaces) - else - excel-text:pad-integer-to-length($tmp, "0", $tmpPlaces) -}; - -(:~ - : Converts a decimal number to octal. - : - : @see http://office.microsoft.com/en-us/excel/HP052090551033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not numeric. - : @error excel-err:Num if provided value for $arg is smaller than -536870912 or bigger than 536870911. - : @return An octal representation of a number given it's decimal representation. - :) -declare function excel-engineering:dec2oct - ($arg as xs:anyAtomicType) as xs:string { - - if (fn:not(excel-math:is-a-number($arg))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) - else - let $tmpNumber := xs:integer($arg) - - return - if(($tmpNumber < -536870912) or ($tmpNumber > 536870911)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -536870912 or bigger than 536870911", $tmpNumber) - else if($tmpNumber < 0) then - let $tmp := 1 + excel-engineering:oct2decUtil(fn:translate( - excel-text:pad-integer-to-length(excel-engineering:dec2octUtil(fn:abs($tmpNumber)), "0", 10), - "01234567", - "76543210")) - return excel-engineering:dec2octUtil($tmp) - else - excel-engineering:dec2octUtil($tmpNumber) -}; - -(:~ - : Converts a decimal number to octal. - : - : @see http://office.microsoft.com/en-us/excel/HP052090551033.aspx?pid=CH062528241033 - : @param $arg the number - : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). - : @error excel-err:Value if provided value for $arg is not numeric - : @error excel-err:Value if provided value for $places is not numeric - : @error excel-err:Num if provided value for $places is zero or negative - : @error excel-err:Num if provided value for $places is too small - : @error excel-err:Num if provided value for $arg is smaller than -536870912 or bigger than 536870911 - : @return An octal representation of a number given it's decimal representation. - :) -declare function excel-engineering:dec2oct - ($arg as xs:anyAtomicType, - $places as xs:anyAtomicType) as xs:string { - - if (fn:not(excel-math:is-a-number($arg))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) - else if(fn:not(excel-math:is-a-number($places))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'places' is not numeric", $places) - else - let $tmpNumber := xs:integer($arg) - let $tmpPlaces := xs:integer($places) - - return - if(($tmpNumber < -536870912) or ($tmpNumber > 536870911)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -536870912 or bigger than 536870911", $tmpNumber) - else if($tmpPlaces < 1) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' is zero or negative", $tmpPlaces) - else - if($tmpNumber < 0) then - let $tmp := 1 + excel-engineering:oct2decUtil(fn:translate( - excel-text:pad-integer-to-length(excel-engineering:dec2octUtil(fn:abs($tmpNumber)), "0", 10), - "01234567", - "76543210")) - return excel-engineering:dec2octUtil($tmp) - else - let $tmp := excel-engineering:dec2octUtil($tmpNumber) - return if($tmpPlaces < fn:string-length($tmp)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' too small", $tmpPlaces) - else - excel-text:pad-integer-to-length($tmp, "0", $tmpPlaces) -}; - -(:~ - : Converts a decimal number to binary. - : - : @see http://office.microsoft.com/en-us/excel/HP052090531033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not numeric. - : @error excel-err:Num if provided value for $arg is smaller than -512 or bigger than 511. - : @return A binary representation of a number given it's decimal representation. - :) -declare function excel-engineering:dec2bin - ($arg as xs:anyAtomicType) as xs:string { - - if (fn:not(excel-math:is-a-number($arg))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) - else - let $tmpNumber := xs:integer($arg) - - return - if(($tmpNumber < -512) or ($tmpNumber > 511)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -512 or bigger than 511", $tmpNumber) - else - if($tmpNumber < 0) then - let $tmp := 1 + excel-engineering:bin2decUtil(fn:translate( - excel-text:pad-integer-to-length(excel-engineering:dec2binUtil(fn:abs($tmpNumber)), "0", 10), - "01", - "10")) - return excel-engineering:dec2binUtil($tmp) - else - excel-engineering:dec2binUtil($tmpNumber) -}; - -(:~ - : Converts a decimal number to binary. - : - : @see http://office.microsoft.com/en-us/excel/HP052090531033.aspx?pid=CH062528241033 - : @param $arg the number. - : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). - : @error excel-err:Value if provided value for $arg is not numeric. - : @error excel-err:Value if provided value for $places is not numeric. - : @error excel-err:Num if provided value for $places is zero or negative. - : @error excel-err:Num if provided value for $places is too small. - : @error excel-err:Num if provided value for $arg is smaller than -512 or bigger than 511. - : @return A binary representation of a number given it's decimal representation. - :) -declare function excel-engineering:dec2bin - ($arg as xs:anyAtomicType, - $places as xs:anyAtomicType) as xs:string { - - if (fn:not(excel-math:is-a-number($arg))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"),"Provided value for 'number' is not numeric", $arg) - else if(fn:not(excel-math:is-a-number($places))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value for 'places' is not numeric", $places) - else - let $tmpNumber := xs:integer($arg) - let $tmpPlaces := xs:integer($places) - - return - if(($tmpNumber < -512) or ($tmpNumber > 511)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -512 or bigger than 511", $tmpNumber) - else if($tmpPlaces < 1) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' is zero or negative", $tmpPlaces) - else - if($tmpNumber < 0) then - let $tmp := 1 + excel-engineering:bin2decUtil(fn:translate( - excel-text:pad-integer-to-length(excel-engineering:dec2binUtil(fn:abs($tmpNumber)), "0", 10), - "01", - "10")) - return excel-engineering:dec2binUtil($tmp) - else - let $tmp := excel-engineering:dec2binUtil($tmpNumber) - return if($tmpPlaces < fn:string-length($tmp)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' too small", $tmpPlaces) - else - excel-text:pad-integer-to-length($tmp, "0", $tmpPlaces) -}; - -(:~ - : Converts an octal number to binary. - : - : @see http://office.microsoft.com/en-us/excel/HP052092001033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not an octal representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @return A binary representation of a number given it's octal representation. - :) -declare function excel-engineering:oct2bin - ($arg as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2bin(excel-engineering:oct2dec($arg)) -}; - -(:~ - : Converts an octal number to binary. - : - : @see http://office.microsoft.com/en-us/excel/HP052092001033.aspx?pid=CH062528241033 - : @param $arg the number. - : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). - : @error excel-err:Value if provided value for $arg is not an octal representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @error excel-err:Value if provided value for $places is not numeric. - : @error excel-err:Num if provided value for $places is zero or negative. - : @error excel-err:Num if provided value for $places is too small. - : @return A binary representation of a number given it's octal representation. - :) -declare function excel-engineering:oct2bin - ($arg as xs:anyAtomicType, - $places as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2bin(excel-engineering:oct2dec($arg),$places) -}; - -(:~ - : Converts an octal number to decimal. - : - : @see http://office.microsoft.com/en-us/excel/HP052092011033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not an octal representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @return A decimal representation of a number given it's octal representation. - :) -declare function excel-engineering:oct2dec - ($arg as xs:anyAtomicType) as xs:integer { - - let $number := fn:string($arg) - return if (fn:not(excel-engineering:is-oct($number))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided string is not an octal representation of a number", $number) - else if(fn:string-length($number) > 10) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Number contains more than 10 characters", $number) - else - if((fn:string-length($number) eq 10) and - fn:substring($number, 1, 1) eq "7") then - -(1 + excel-engineering:oct2decUtil(fn:translate($number,"01234567", "76543210"))) - else - excel-engineering:oct2decUtil($number) -}; - -(:~ - : Converts a binary number to decimal. - : - : @see http://office.microsoft.com/en-us/excel/HP052090021033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not a binary representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @return A decimal representation of a number given it's binary representation. - :) -declare function excel-engineering:bin2dec - ($arg as xs:anyAtomicType) as xs:integer { - - let $number := fn:string($arg) - return if (fn:not(excel-engineering:is-bin($number))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided string is not a binary representation of a number", $number) - else if(fn:string-length($number) > 10) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Number contains more than 10 characters", $number) - else - if((fn:string-length($number) eq 10) and - (fn:substring($number, 1, 1) eq "1")) then - -(1 + excel-engineering:bin2decUtil(fn:translate($number,"01", "10"))) - else - excel-engineering:bin2decUtil ($number) -}; - -(:~ - : Converts an octal number to hexadecimal. - : - : @see http://office.microsoft.com/en-us/excel/HP052092021033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not an octal representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @return A hexadecimal representation of a number given it's octal representation. - :) -declare function excel-engineering:oct2hex - ($arg as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2hex(excel-engineering:oct2dec($arg)) -}; - -(:~ - : Converts an octal number to hexadecimal. - : - : @see http://office.microsoft.com/en-us/excel/HP052092021033.aspx?pid=CH062528241033 - : @param $arg the number. - : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). - : @error excel-err:Value if provided value for $arg is not an octal representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @error excel-err:Value if provided value for $places is not numeric. - : @error excel-err:Num if provided value for $places is zero or negative. - : @error excel-err:Num if provided value for $places is too small. - : @return A hexadecimal representation of a number given it's octal representation. - :) -declare function excel-engineering:oct2hex - ($arg as xs:anyAtomicType, - $places as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2hex(excel-engineering:oct2dec($arg),$places) -}; - -(:~ - : Converts a hexadecimal number to binary. - : - : @see http://office.microsoft.com/en-us/excel/HP052091101033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not a hexadecimal representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @return A binary representation of a number given it's hexadecimal representation. - :) -declare function excel-engineering:hex2bin - ($arg as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2bin(excel-engineering:hex2dec($arg)) -}; - -(:~ - : Converts a hexadecimal number to binary. - : - : @see http://office.microsoft.com/en-us/excel/HP052091101033.aspx?pid=CH062528241033 - : @param $arg the number. - : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). - : @error excel-err:Value if provided value for $arg is not a hexadecimal representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @error excel-err:Value if provided value for $places is not numeric. - : @error excel-err:Num if provided value for $places is zero or negative. - : @error excel-err:Num if provided value for $places is too small. - : @return A binary representation of a number given it's hexadecimal representation. - :) -declare function excel-engineering:hex2bin - ($arg as xs:anyAtomicType, - $places as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2bin(excel-engineering:hex2dec($arg),$places) -}; - -(:~ - : Converts a hexadecimal number to octal. - : - : @see http://office.microsoft.com/en-us/excel/HP052091121033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not a hexadecimal representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @return A octal representation of a number given it's hexadecimal representation. - :) -declare function excel-engineering:hex2oct - ($arg as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2oct(excel-engineering:hex2dec($arg)) -}; - -(:~ - : Converts a hexadecimal number to octal. - : - : @see http://office.microsoft.com/en-us/excel/HP052091121033.aspx?pid=CH062528241033 - : @param $arg the number. - : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). - : @error excel-err:Value if provided value for $arg is not a hexadecimal representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @error excel-err:Value if provided value for $places is not numeric. - : @error excel-err:Num if provided value for $places is zero or negative. - : @error excel-err:Num if provided value for $places is too small. - : @return A octal representation of a number given it's hexadecimal representation. - :) -declare function excel-engineering:hex2oct - ($arg as xs:anyAtomicType, - $places as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2oct(excel-engineering:hex2dec($arg),$places) -}; - -(:~ - : Converts a hexadecimal number to decimal. - : - : @see http://office.microsoft.com/en-us/excel/HP052091111033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not a hexadecimal representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @return A decimal representation of a number given it's hexadecimal representation. - :) -declare function excel-engineering:hex2dec - ($arg as xs:string) as xs:integer { - - let $number := fn:upper-case($arg) - return if (fn:not(excel-engineering:is-hex($number))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided string is not a hexadecimal representation of a number", $arg) - else if(fn:string-length($number) > 10) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Number contains more than 10 characters", $arg) - else - if((fn:string-length($number) eq 10) and - fn:substring($number, 1, 1) eq "F") then - -(1 + excel-engineering:hex2decUtil(fn:translate($number,"0123456789ABCDEF", "FEDCBA9876543210"))) - else - excel-engineering:hex2decUtil($number) -}; - -(:~ - : Converts a binary number to octal. - : - : @see http://office.microsoft.com/en-us/excel/HP052090041033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not a binary representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @return A octal representation of a number given it's binary representation. - :) -declare function excel-engineering:bin2oct - ($arg as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2oct(excel-engineering:bin2dec($arg)) -}; - -(:~ - : Converts a binary number to octal. - : - : @see http://office.microsoft.com/en-us/excel/HP052090041033.aspx?pid=CH062528241033 - : @param $arg the number. - : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). - : @error excel-err:Value if provided value for $arg is not a binary representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @error excel-err:Value if provided value for $places is not numeric. - : @error excel-err:Num if provided value for $places is zero or negative. - : @error excel-err:Num if provided value for $places is too small. - : @return A octal representation of a number given it's binary representation. - :) -declare function excel-engineering:bin2oct - ($arg as xs:anyAtomicType, - $places as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2oct(excel-engineering:bin2dec($arg),$places) -}; - -(:~ - : Converts a binary number to hexadecimal. - : - : @see http://office.microsoft.com/en-us/excel/HP052090031033.aspx?pid=CH062528241033 - : @param $arg the number. - : @error excel-err:Value if provided value for $arg is not a binary representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @return A hexadecimal representation of a number given it's binary representation. - :) -declare function excel-engineering:bin2hex - ($arg as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2hex(excel-engineering:bin2dec($arg)) -}; - -(:~ - : Converts a binary number to hexadecimal. - : - : @see http://office.microsoft.com/en-us/excel/HP052090031033.aspx?pid=CH062528241033 - : @param $arg the number. - : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). - : @error excel-err:Value if provided value for $arg is not a binary representation of a number. - : @error excel-err:Value if provided value for $arg contains more than 10 characters. - : @error excel-err:Value if provided value for $places is not numeric. - : @error excel-err:Num if provided value for $places is zero or negative. - : @error excel-err:Num if provided value for $places is too small. - : @return A hexadecimal representation of a number given it's binary representation. - :) -declare function excel-engineering:bin2hex - ($arg as xs:anyAtomicType, - $places as xs:anyAtomicType) as xs:string { - - excel-engineering:dec2hex(excel-engineering:bin2dec($arg),$places) -}; diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/information.xq zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/information.xq --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/information.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/information.xq 1970-01-01 00:00:00.000000000 +0000 @@ -1,160 +0,0 @@ -xquery version "3.0"; - -(: - : Copyright 2006-2009 The FLWOR Foundation. - : - : Licensed under the Apache License, Version 2.0 (the "License"); - : you may not use this file except in compliance with the License. - : You may obtain a copy of the License at - : - : http://www.apache.org/licenses/LICENSE-2.0 - : - : Unless required by applicable law or agreed to in writing, software - : distributed under the License is distributed on an "AS IS" BASIS, - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - : See the License for the specific language governing permissions and - : limitations under the License. -:) - -(:~ - : This is a library module offering the same set of functions - : defined by Microsoft Excel, under Information Functions. - : - : @author Sorin Nasoi - : - : @see Excel Documentation: Information Functions - : - : @project Zorba/Excel/Information - :) -module namespace excel-information = "http://www.zorba-xquery.com/modules/excel/information" ; - -declare namespace excel-err = "http://www.zorba-xquery.com/modules/excel/errors"; - -(:~ - : Import excel-math module functions. - :) -import module namespace excel-math = "http://www.zorba-xquery.com/modules/excel/math"; - -declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; -declare option ver:module-version "1.0"; - - -(:~ - : Test if the passed argument is empty of not. - : - : @see http://www.w3.org/TR/xquery-operators/#func-empty - : @param $value the value. - : @return If the value of $arg is the empty sequence, the function returns true, otherwise the function returns false. - :) -declare function excel-information:is-blank - ( $value as xs:anyAtomicType? ) as xs:boolean { - fn:empty($value) - }; - -(:~ - : Test is a number is even. - : - : @see http://office.microsoft.com/en-us/excel/HP052091481033.aspx - : @param $value the value. - : @error excel-err:Value if provided value is not a number. - : @return TRUE if number is even, FALSE if number is odd. - :) -declare function excel-information:is-even - ( $value as xs:anyAtomicType? ) as xs:boolean { - - if(excel-math:is-a-number($value)) then - fn:not(fn:boolean(fn:floor(fn:abs(fn:number($value))) mod 2)) - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value is not a number", $value) - }; - -(:~ - : Test is a number is odd. - : - : @see http://office.microsoft.com/en-us/excel/HP052091491033.aspx - : @param $value the value. - : @error excel-err:Value if provided value is not a number. - : @return TRUE if number is odd, FALSE if number is even. - :) -declare function excel-information:is-odd - ( $value as xs:anyAtomicType? ) as xs:boolean { - - if(excel-math:is-a-number($value)) then - fn:boolean(fn:floor(fn:abs(fn:number($value))) mod 2) - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value is not a number", $value) - }; - -(:~ - : Tests if the passed $value is a logical value. - : - : @see http://office.microsoft.com/en-us/excel/HP052091471033.aspx - : @param $value the value. - : @return TRUE if $value refers to a logical value. - :) -declare function excel-information:islogical - ( $value as xs:anyAtomicType? ) as xs:boolean { - - if ($value instance of xs:boolean) then fn:true() - else fn:false() - }; - -(:~ - : Tests if the passed $value is a number. - : - : @see http://office.microsoft.com/en-us/excel/HP052091471033.aspx - : @param $value the value. - : @return TRUE if $value refers to a number. - :) -declare function excel-information:isnumber - ( $value as xs:anyAtomicType? ) as xs:boolean { - - if (($value instance of xs:integer) or - ($value instance of xs:decimal) or - ($value instance of xs:float) or - ($value instance of xs:double)) then fn:true() - else fn:false() - }; - -(:~ - : Tests if the passed $value is a string. - : - : @see http://office.microsoft.com/en-us/excel/HP052091471033.aspx - : @param $value the value. - : @return TRUE if $value refers to text. - :) -declare function excel-information:istext - ( $value as xs:anyAtomicType? ) as xs:boolean { - - if ($value instance of xs:string) then fn:true() - else fn:false() - }; - -(:~ - : Converts a $value to a number. - : - : @see http://office.microsoft.com/en-us/excel/HP052091871033.aspx - : @param $value the value. - : @return A $value converted to a number. - :) -declare function excel-information:n - ( $value as xs:anyAtomicType? ) as xs:anyAtomicType { - - if( excel-information:isnumber($value)) then $value - else if( excel-information:islogical($value)) then $value cast as xs:integer - else 0 - }; - -(:~ - : Raises the error value #N/A. - : - : @see http://office.microsoft.com/en-us/excel/HP052091881033.aspx - : @error excel-err:NA the purpose of this function is to raise this error - : @return The error value #N/A. #N/A is the error value that means "no value is available." - :) -declare function excel-information:na - () as xs:anyAtomicType { - - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "No value is available") - }; diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/logical.xq zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/logical.xq --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/logical.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/logical.xq 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ -xquery version "1.0"; - -(: - : Copyright 2006-2009 The FLWOR Foundation. - : - : Licensed under the Apache License, Version 2.0 (the "License"); - : you may not use this file except in compliance with the License. - : You may obtain a copy of the License at - : - : http://www.apache.org/licenses/LICENSE-2.0 - : - : Unless required by applicable law or agreed to in writing, software - : distributed under the License is distributed on an "AS IS" BASIS, - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - : See the License for the specific language governing permissions and - : limitations under the License. -:) - -(:~ - : This is a library module offering the same set of functions - : defined by Microsoft Excel, under Logical Functions. - : - : @author Sorin Nasoi - : - : @see Excel Documentation: Logical Functions - : @project Zorba/Excel/Logical - : - :) -(: for False,Not and True use fn:false(), fn:not(), fn:true() :) - -module namespace excel-logical = "http://www.zorba-xquery.com/modules/excel/logical" ; - -declare namespace excel-err = "http://www.zorba-xquery.com/modules/excel/errors"; - -declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; -declare option ver:module-version "1.0"; - -(:~ - : Returns TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE. - : - : @see http://office.microsoft.com/en-us/excel/HP052089861033.aspx - : @param $arg1 the first argument. - : @param $arg2 the second argument. - : @return TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE. - :) -declare function excel-logical:and - ( $arg1 as xs:anyAtomicType, - $arg2 as xs:anyAtomicType) as xs:boolean { - fn:boolean(($arg1 and $arg2)) - }; - -(:~ - : Returns TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE. - : - : @see http://office.microsoft.com/en-us/excel/HP052089861033.aspx - : @param $values the sequence of arguments. - : @error excel-err:Value provided sequence is empty. - : @return TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE. - :) -declare function excel-logical:and - ( $values as xs:anyAtomicType* ) as xs:boolean { - let $distValues := distinct-values($values) - return - if(fn:empty($distValues)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided sequence is empty", $values) - else - every $value in $distValues satisfies $value eq fn:true() - }; - -(:~ - : Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. - : - : @see http://office.microsoft.com/en-us/excel/HP052091181033.aspx - : @param $logical_test is any value or expression that can be evaluated to TRUE or FALSE. - : @param $value_if_true the value that is returned if logical_test is TRUE. - : @param $value_if_false the value that is returned if logical_test is FALSE. - : @return One value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. - :) -declare function excel-logical:if - ( $logical_test as xs:boolean, - $value_if_true as item()*, - $value_if_false as item()*) as item()* { - if($logical_test) then - $value_if_true - else - $value_if_false - }; - -(:~ - : Returns TRUE if any argument is TRUE; FALSE if all arguments are FALSE. - : - : @see http://office.microsoft.com/en-us/excel/HP052092091033.aspx - : @param $arg1 the first argument. - : @param $arg2 the second argument. - : @return TRUE if any argument is TRUE; FALSE if all arguments are FALSE. - :) -declare function excel-logical:or - ( $arg1 as xs:anyAtomicType, - $arg2 as xs:anyAtomicType) as xs:boolean { - fn:boolean(($arg1 or $arg2)) - }; - -(:~ - : Returns TRUE if any argument is TRUE; FALSE if all arguments are FALSE. - : - : @see http://office.microsoft.com/en-us/excel/HP052092091033.aspx - : @param $values the sequence of arguments. - : @error excel-err:Value provided sequence is empty. - : @return TRUE if any argument is TRUE; FALSE if all arguments are FALSE. - :) -declare function excel-logical:or - ( $values as xs:anyAtomicType* ) as xs:boolean { - let $distValues := distinct-values($values) - return - if(fn:empty($distValues)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided sequence is empty", $values) - else - some $value in $distValues satisfies $value eq fn:true() - }; diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/lookup.xq zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/lookup.xq --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/lookup.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/lookup.xq 1970-01-01 00:00:00.000000000 +0000 @@ -1,841 +0,0 @@ -xquery version "3.0"; - -(: - : Copyright 2006-2009 The FLWOR Foundation. - : - : Licensed under the Apache License, Version 2.0 (the "License"); - : you may not use this file except in compliance with the License. - : You may obtain a copy of the License at - : - : http://www.apache.org/licenses/LICENSE-2.0 - : - : Unless required by applicable law or agreed to in writing, software - : distributed under the License is distributed on an "AS IS" BASIS, - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - : See the License for the specific language governing permissions and - : limitations under the License. - :) - -(:~ - : This module implements some Excel 2003 lookup functions. - : - : @see Excel 2003 Documentation: Lookup Functions - : - : @author Daniel Turcanu - : @project Zorba/Excel/Lookup - : - :) -module namespace excel = "http://www.zorba-xquery.com/modules/excel/lookup" ; - -declare namespace excel-err = "http://www.zorba-xquery.com/modules/excel/errors"; -(:~ - : Use excel-math module functions. - :) -import module namespace excel-math="http://www.zorba-xquery.com/modules/excel/math"; - -declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; -declare option ver:module-version "1.0"; - -(:~ - : Uses index_num to return a value from the sequence of value arguments. - : - : @see http://office.microsoft.com/en-us/excel/HP052090131033.aspx - : @param $index_num The position in the sequence, 1 based. - : @param $values The sequence of values. - : @return The value at the index position. - : @error excel-err:Value if index is smaller than 1 or bigger than the size of sequence. - : @example test/Queries/excel/lookup/choose1.xq - :) -declare function excel:choose( - $index_num as xs:integer, - $values as xs:anyAtomicType*) as xs:anyAtomicType -{ - if ($index_num lt 1 or $index_num gt fn:count($values)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Choose function: index_num should be between 1 and value count ", $index_num) - else - $values[$index_num] -}; - -(:~ - : Uses index_num to return a sequence from the list of sequences. - : Use CHOOSE to select one of up to 29 sequences based on the index number. - : - : @see http://office.microsoft.com/en-us/excel/HP052090131033.aspx - : @param $index_num the position in the sequence, 1 based - : @param $value_sequence1 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence2 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence3 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence4 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence5 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence6 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence7 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence8 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence9 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence10 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence11 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence12 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence13 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence14 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence15 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence16 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence17 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence18 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence19 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence20 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence21 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence22 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence23 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence24 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence25 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence26 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence27 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence28 a sequence of values. Specify the empty sequence () if you don't need it. - : @param $value_sequence29 a sequence of values. Specify the empty sequence () if you don't need it. - : @return The value at the index position - : @error excel-err:Value if index is smaller than 1 or bigger than 29 - : @example test/Queries/excel/lookup/choose2.xq - :) -declare function excel:choose( - $index_num as xs:integer, - $value_sequence1 as xs:anyAtomicType*, - $value_sequence2 as xs:anyAtomicType*, - $value_sequence3 as xs:anyAtomicType*, - $value_sequence4 as xs:anyAtomicType*, - $value_sequence5 as xs:anyAtomicType*, - $value_sequence6 as xs:anyAtomicType*, - $value_sequence7 as xs:anyAtomicType*, - $value_sequence8 as xs:anyAtomicType*, - $value_sequence9 as xs:anyAtomicType*, - $value_sequence10 as xs:anyAtomicType*, - $value_sequence11 as xs:anyAtomicType*, - $value_sequence12 as xs:anyAtomicType*, - $value_sequence13 as xs:anyAtomicType*, - $value_sequence14 as xs:anyAtomicType*, - $value_sequence15 as xs:anyAtomicType*, - $value_sequence16 as xs:anyAtomicType*, - $value_sequence17 as xs:anyAtomicType*, - $value_sequence18 as xs:anyAtomicType*, - $value_sequence19 as xs:anyAtomicType*, - $value_sequence20 as xs:anyAtomicType*, - $value_sequence21 as xs:anyAtomicType*, - $value_sequence22 as xs:anyAtomicType*, - $value_sequence23 as xs:anyAtomicType*, - $value_sequence24 as xs:anyAtomicType*, - $value_sequence25 as xs:anyAtomicType*, - $value_sequence26 as xs:anyAtomicType*, - $value_sequence27 as xs:anyAtomicType*, - $value_sequence28 as xs:anyAtomicType*, - $value_sequence29 as xs:anyAtomicType*) as xs:anyAtomicType* -{ - if ($index_num lt 1 or $index_num gt 29) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Choose function: index_num should be between 1 and 29 ", $index_num) - else if ($index_num = 1) then - $value_sequence1 - else if ($index_num = 2) then - $value_sequence2 - else if ($index_num = 3) then - $value_sequence3 - else if ($index_num eq 4) then - $value_sequence4 - else if ($index_num eq 5) then - $value_sequence5 - else if ($index_num eq 6) then - $value_sequence6 - else if ($index_num eq 7) then - $value_sequence7 - else if ($index_num eq 8) then - $value_sequence8 - else if ($index_num eq 9) then - $value_sequence9 - else if ($index_num eq 10) then - $value_sequence10 - else if ($index_num eq 11) then - $value_sequence11 - else if ($index_num eq 12) then - $value_sequence12 - else if ($index_num eq 13) then - $value_sequence13 - else if ($index_num eq 14) then - $value_sequence14 - else if ($index_num eq 15) then - $value_sequence15 - else if ($index_num eq 16) then - $value_sequence16 - else if ($index_num eq 17) then - $value_sequence17 - else if ($index_num eq 18) then - $value_sequence18 - else if ($index_num eq 19) then - $value_sequence19 - else if ($index_num eq 20) then - $value_sequence20 - else if ($index_num eq 21) then - $value_sequence21 - else if ($index_num eq 22) then - $value_sequence22 - else if ($index_num eq 23) then - $value_sequence23 - else if ($index_num eq 24) then - $value_sequence24 - else if ($index_num eq 25) then - $value_sequence25 - else if ($index_num eq 26) then - $value_sequence26 - else if ($index_num eq 27) then - $value_sequence27 - else if ($index_num eq 28) then - $value_sequence28 - else if ($index_num eq 29) then - $value_sequence29 - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Choose function: index_num should be between 1 and 29 ", $index_num) -}; - -(:~ - : Function for HLOOKUP, LOOKUP, MATCH, VLOOKUP. - : This function should not be used outside this module. - : It searches a lookup_value in table_header with three different algorithms - : specified by range_lookup. - : - : @param $lookup_value the value to be searched. - : Allowed types are numeric, string, boolean. - : Boolean values are compared only with booleans. - : Numbers are compared only with numbers, if range_lookup is not zero. - : The other types are converted to string and compared to string value of all values. - : @param $table_header the sequence of values where to search - : @param $range_lookup specified the algorithm for searching. - : Can have values: - : 1 = finds the largest value that is less than or equal to lookup_value. - : Table_header must be in ascending order. - : 0 = finds the first value that is exactly equal to lookup_value. - : Table_header can be in any order. - : If lookup_value is boolean, then only booleans are compared. - : For other types, they are casted to string and then compared using - : xquery regular expressions. Lookup_value can be a xquery regular expression. - : -1 = finds the smallest value that is greater than or equal to lookup_value. - : Table_header must be in descending order. - : @param $pos the current position in original table_header - : @param $last_comparable_pos the position of last value that might be a match - : @return the value found - : @error excel-err:Value if range_lookup=0 and the value cannot be found - :) -declare %private function excel:lookup-column( - $lookup_value as xs:anyAtomicType, - $table_header as xs:anyAtomicType*, - $range_lookup as xs:integer, - $pos as xs:integer, - $last_comparable_pos as xs:integer) as xs:integer -{ - if (fn:empty($table_header)) then - if ($range_lookup != 0) then - $last_comparable_pos - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Hlookup function: cannot find lookup value ", $lookup_value) - else if ($range_lookup gt 0) then - if ($lookup_value instance of xs:boolean) then - if ($table_header[1] instance of xs:boolean) then - if ($lookup_value = $table_header[1]) then - $pos + 1 - else if ($lookup_value < $table_header[1]) then - $last_comparable_pos - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $last_comparable_pos) - else if (excel-math:is-a-number($lookup_value)) then - if (excel-math:is-a-number($table_header[1])) then - let $lookup_value_num := excel-math:cast-as-numeric($lookup_value) - let $table_header_num := excel-math:cast-as-numeric($table_header[1]) - return - if ($lookup_value_num = $table_header_num) then - $pos + 1 - else if ($lookup_value_num < $table_header_num) then - $last_comparable_pos - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $last_comparable_pos) - else - let $compare := fn:compare(fn:upper-case(fn:string($lookup_value)), - fn:upper-case(fn:string($table_header[1]))) - return - if ($compare eq 0) then - $pos + 1 - else if ($compare lt 0) then - $last_comparable_pos - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) - else if ($range_lookup lt 0) then - if ($lookup_value instance of xs:boolean) then - if ($table_header[1] instance of xs:boolean) then - if ($lookup_value = $table_header[1]) then - $pos + 1 - else if ($lookup_value > $table_header[1]) then - $last_comparable_pos - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $last_comparable_pos) - else if (excel-math:is-a-number($lookup_value)) then - if (excel-math:is-a-number($table_header[1])) then - let $lookup_value_num := excel-math:cast-as-numeric($lookup_value) - let $table_header_num := excel-math:cast-as-numeric($table_header[1]) - return - if ($lookup_value_num = $table_header_num) then - $pos + 1 - else if ($lookup_value_num > $table_header_num) then - $last_comparable_pos - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $last_comparable_pos) - else - let $compare := fn:compare(fn:upper-case(fn:string($lookup_value)), - fn:upper-case(fn:string($table_header[1]))) - return - if ($compare eq 0) then - $pos + 1 - else if ($compare gt 0) then - $last_comparable_pos - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) - else if ($lookup_value instance of xs:boolean) then - if ($table_header[1] instance of xs:boolean) then - if ($lookup_value = $table_header[1]) then - $pos + 1 - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, 0) - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, 0) - else if (fn:matches(fn:upper-case(fn:string($table_header[1])), - fn:upper-case(fn:string($lookup_value)))) then - $pos + 1 - else - excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, 0) -}; - -(:~ - : Searches for a value in the top row of an array of values, - : and then returns a value in the same column from a row you specify in the array. - :
Array is specified with 3 parameters: - :
table_array
is a sequence of elements, first row first, then second row and so on
- :
table_width
specifies the number of elements in a row
- :
table_height
specifies the number of rows
- : The number of elements in table_array must be equal or more than table_width * table_height.
- : - : For wildchar matching, the XQuery regex matcher is used. - : - : @see http://office.microsoft.com/en-us/excel/HP052091141033.aspx - : @param $lookup_value the value to be searched. - : Allowed types are numeric, string, boolean.
- : Boolean values are compared only with booleans. - : Numbers are compared only with numbers, if range_lookup is not zero. - : The other types are converted to string and compared to string value of all values. - : @param $table_array the sequence of values, row after row - : @param $table_width the number of values in a row - : @param $table_height the number of rows - : @param $row_index_num the row index, 1 based - : @param $range_lookup
specifies the algorithm to use: - :
true
find approximative match. - : First row of array must be sorted in ascending order.
- :
false
find exact match, using xquery regex - : First row of array can be in any order.
- : @return The value found, with original type - : @error excel-err:Value if the array contains less elements than specified by table_height and table_width - : @error excel-err:Value if row_index_num is outside the range 1 .. table_height - : @error excel-err:Value if range_lookup is true and the value searched is smaller than - : the first value in the header - : @error excel-err:Value if range_lookup=false and the value cannot be found - : @example test/Queries/excel/lookup/hlookup1.xq - : @example test/Queries/excel/lookup/hlookup2.xq - : @example test/Queries/excel/lookup/hlookup3.xq - : @example test/Queries/excel/lookup/hlookup4.xq - : @example test/Queries/excel/lookup/hlookup5.xq - :) -declare function excel:hlookup( - $lookup_value as xs:anyAtomicType, - $table_array as xs:anyAtomicType+, - $table_width as xs:integer, - $table_height as xs:integer, - $row_index_num as xs:integer, - $range_lookup as xs:boolean) as xs:anyAtomicType -{ - if ($table_height * $table_width gt fn:count($table_array)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Hlookup function: table array width and height not specified correctly ", $table_width * 1000 + $table_height) - else if ($row_index_num lt 1 or $row_index_num gt $table_height) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Hlookup function: row_index_num must be between 1 and table height ", $row_index_num) - else - let $table_header := ( - for $i in (1 to $table_width) - return - $table_array[$i] - ) - let $column := excel:lookup-column($lookup_value, $table_header, $range_lookup cast as xs:integer, 0, 0) - return - if ($column eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Hlookup function: lookup value is smaller than the first element in header", $lookup_value) - else if ($column gt $table_width) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Hlookup function: column found outside table array ", $column) - else - $table_array[($row_index_num - 1) * $table_width + $column] -}; - -(:~ - : Same as above, only that range_lookup is defaulted to true. - : That is, this Hlookup looks for the approximate value - : and the first row must be ordered ascending. - : @see http://office.microsoft.com/en-us/excel/HP052091141033.aspx - : @param $lookup_value the value to be searched. - : Allowed types are numeric, string, boolean.
- : Boolean values are compared only with booleans. - : Numbers are compared only with numbers, if range_lookup is not zero. - : The other types are converted to string and compared to string value of all values. - : @param $table_array the sequence of values, row after row - : @param $table_width the number of values in a row - : @param $table_height the number of rows - : @param $row_index_num the row index, 1 based - : @return The value found, with original type - : @error excel-err:Value if the array contains less elements than specified by table_height and table_width - : @error excel-err:Value if row_index_num is outside the range 1 .. table_height - : @error excel-err:Value if range_lookup is true and the value searched is smaller than - : the first value in the header - : @error excel-err:Value if range_lookup=false and the value cannot be found - :) -declare function excel:hlookup( - $lookup_value as xs:anyAtomicType, - $table_array as xs:anyAtomicType+, - $table_width as xs:integer, - $table_height as xs:integer, - $row_index_num as xs:integer) as xs:anyAtomicType -{ - excel:hlookup($lookup_value, $table_array, $table_width, $table_height, - $row_index_num, fn:true()) -}; - -(:~ - : Returns a value from within an array.
- : This is the Array form of the Excel Index function.
- : - :
Array is specified with 3 parameters: - :
array
is a sequence of elements, first row first, then second row and so on
- :
array_height
specifies the number of rows
- :
array_width
specifies the number of elements in a row
- : The number of elements in array must be equal or more than array_width * array_height. - : - : @see http://office.microsoft.com/en-us/excel/HP052091381033.aspx - : @param $array the sequence of values, row after row - : @param $array_width the number of values in a row - : @param $array_height the number of rows - : @param $row_num the row position of the value, 1 based - : @param $column_num the column position of the value, 1 based - : @return The value from x-y in the array - : @error excel-err:Value if the array contains less elements than specified by table_height and table_width - : @error excel-err:Ref if row_num is outside the range - : @example test/Queries/excel/lookup/index1.xq - : @example test/Queries/excel/lookup/index2.xq - : @example test/Queries/excel/lookup/index3.xq - : @example test/Queries/excel/lookup/index4.xq - : @example test/Queries/excel/lookup/index5.xq -:) -declare function excel:index( - $array as xs:anyAtomicType+, - $array_height as xs:integer, - $array_width as xs:integer, - $row_num as xs:integer, - $column_num as xs:integer) as xs:anyAtomicType+ -{ - if ($array_height * $array_width != fn:count($array)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Index function: array width and height not specified correctly ", $array_width * 1000 + $array_height) - else - if ($row_num < 0 or $row_num > $array_height) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Ref"), "Index function: row_num must be between 1 and array height or 0", $row_num) - else - if ($column_num < 0 or $column_num > $array_width) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Ref"), "Index function: column_num must be between 1 and array width or 0", $column_num) - else - if ($array_height = 1) then - if ($column_num ge 1) then - $array[$column_num] - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Ref"), "Index function: column_num must be between 1 and array width", $column_num) - else - if ($array_width = 1) then - if ($row_num ge 1) then - $array[$row_num] - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Ref"), "Index function: row_num must be between 1 and array width", $row_num) - else - if ($row_num > 0 and $column_num > 0) then - $array[($row_num - 1) * $array_width + $column_num] - else - if ($column_num = 0) then - for $i in (1 to $array_width) return - $array[($row_num - 1)* $array_width + $i] - else - for $i in (1 to $array_height) return - $array[($i - 1) * $array_width + $column_num] -}; - -(:~ - : The Vector form.
- : Looks in a sequence for a value - : and return a value from the same position in a second sequence. - : If the value is not found, then it matches the largest value in lookup_vector - : that is less than or equal to lookup_value. - : - : @see http://office.microsoft.com/en-us/excel/HP052091631033.aspx - : @param $lookup_value the value to be searched - : @param $lookup_vector the sequence to be searched, in ascending order. - : @param $result_vector the sequence containing the result values - : @return a value from $result_vector - : @error excel-err:NA if lookup value is smaller than the first value in lookup_vector - : @error excel-err:NA if position found is outside the result range - : @example test/Queries/excel/lookup/lookup1.xq - : @example test/Queries/excel/lookup/lookup2.xq - : @example test/Queries/excel/lookup/lookup3.xq - : @example test/Queries/excel/lookup/lookup4.xq - :) -declare function excel:lookup( - $lookup_value as xs:anyAtomicType, - $lookup_vector as xs:anyAtomicType+, - $result_vector as xs:anyAtomicType+) as xs:anyAtomicType -{ - let $pos := excel:lookup-column($lookup_value, $lookup_vector, 1, 0, 0) return - if ($pos eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Lookup function: lookup value is smaller than any vector values ", $lookup_value) - else if ($pos gt fn:count($result_vector)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Lookup function: lookup position is outside the result range ", $pos) - else - $result_vector[$pos] -}; - -(:~ - : The Array form.
- : It looks in the first row or column of an array for the specified value - : and returns a value from the same position in the last row or column of the array.
- : If array covers an area that is wider than it is tall (more columns than rows), - : LOOKUP searches for lookup_value in the first row.
- : If array is square or is taller than it is wide (more rows than columns), - : LOOKUP searches in the first column.
- : - : The values in the first row or first column must be in ascending order. - : - : @see http://office.microsoft.com/en-us/excel/HP052091631033.aspx - : @param $lookup_value the value to be searched. - : If the value is not found, then it matches the largest value in lookup_vector - : that is less than or equal to lookup_value. - : @param $array the array sequence, row after row - : @param $array_width the number of values in a row - : @param $array_height the number of rows in the array - : @return The corresponding value in the last row or column - : @error excel-err:Value if array contains less values than specified by array_width and array_height - : or array_width = 0 or array_height = 0 - : @error excel-err:NA if the lookup_value is smaller than the first value in the row or column - : @example test/Queries/excel/lookup/lookup5.xq - : @example test/Queries/excel/lookup/lookup6.xq - : @example test/Queries/excel/lookup/lookup7.xq - :) -declare function excel:lookup( - $lookup_value as xs:anyAtomicType, - $array as xs:anyAtomicType+, - $array_width as xs:integer, - $array_height as xs:integer) as xs:anyAtomicType -{ - if ($array_height * $array_width ne fn:count($array) or $array_height eq 0 or $array_width eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Lookup function: array width and height not specified correctly ", $array_width * 1000 + $array_height) - else if ($array_width gt $array_height) then - let $header := ( - for $i in (1 to $array_width) - return - $array[$i] - ) - let $pos := excel:lookup-column($lookup_value, $header, 1, 0, 0) - return - if ($pos eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Lookup function: lookup value is smaller than any vector values in the first row ", $lookup_value) - else - $array[($array_height - 1) * $array_width + $pos] - else - let $header := ( - for $i in (1 to $array_height) - return - $array[($i - 1) * $array_width + 1] - ) - let $pos := excel:lookup-column($lookup_value, $header, 1, 0, 0) - return - if ($pos eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Lookup function: lookup value is smaller than any vector values in the first column ", $lookup_value) - else - $array[($pos - 1) * $array_width + $array_width] -}; - -(:~ - : Returns the relative position of an item in a sequence that - : matches a specified value in a specified order. - : Only for one dimensional vector. - : - : @see http://office.microsoft.com/en-us/excel/HP052091681033.aspx - : @param $lookup_value value to be searched. - : @param $sequence the vector where to search the value - : @param $match_type
specifies the algorithm used for searching. - : Possible values: - :
1
finds the largest value that is less than or equal to lookup_value. - : Sequence must be in ascending order.
- :
0
finds the first value that is exactly equal to lookup_value.
- : Sequence can be in any order.
- : If lookup_value is boolean, then only booleans are compared.
- : For other types, they are casted to string and then compared using - : xquery regular expressions. Lookup_value can be a xquery regular expression.
- :
-1
finds the smallest value that is greater than or equal to lookup_value.
- : Sequence must be in descending order.
- : @return The position of found value - : @error excel-err:NA for match_type 1 or -1, the lookup_value is smaller or larger than - : the first value in sequence - : @error excel-err:Value if range_lookup=0 and the value cannot be found - : @example test/Queries/excel/lookup/match2.xq - : @example test/Queries/excel/lookup/match3.xq - :) -declare function excel:match( - $lookup_value as xs:anyAtomicType, - $sequence as xs:anyAtomicType+, - $match_type as xs:integer) as xs:anyAtomicType -{ - let $pos := excel:lookup-column($lookup_value, $sequence, $match_type, 0, 0) - return - if ($pos eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Match function: cannot match lookup value ", $lookup_value) - else - $pos -}; - -(:~ - : Same as above, but match_type is defaulted to 1. - : It finds the largest value that is less than or equal to lookup_value. - : @see http://office.microsoft.com/en-us/excel/HP052091681033.aspx - : @param $lookup_value value to be searched. - : @param $sequence the vector where to search the value - : @return The position of found value - : @error excel-err:NA for match_type 1 or -1, the lookup_value is smaller or larger than - : the first value in sequence - : @error excel-err:Value if range_lookup=0 and the value cannot be found - : @example test/Queries/excel/lookup/match1.xq - :) -declare function excel:match( - $lookup_value as xs:anyAtomicType, - $sequence as xs:anyAtomicType+) as xs:anyAtomicType -{ - excel:match($lookup_value, $sequence, 1) -}; - -(:~ - : Returns a sub-array from an array. - : The inner array must be within the reference array - : - : @see http://office.microsoft.com/en-us/excel/HP052092081033.aspx - : @param $reference the reference array - : @param $reference_height the number of rows in the reference array - : @param $reference_width the number of elements in the reference array row - : @param $rows the relative row position where the sub-array starts. - : It must be a positive value, zero relative. - : @param $cols the relative column position where the sub-array starts. - : It must be a positive value, zero relative. - : @param $height the desired height of sub-array. - : The sub-array must be inside the reference array. - : @param $width the desired width of sub-array. - : The sub-array must be inside the reference array. - : @return The sequence specifying the sub-array, row after row - : @error excel-err:NA rows or cols are negative - : @error excel-err:NA height or width are smaller than 1 - : @error excel-err:Value reference array contains less elements than specified - : by reference_height and reference_width - : @error excel-err:NA the resulted sub-array is not completely contained inside reference array - : @example test/Queries/excel/lookup/offset3.xq - : @example test/Queries/excel/lookup/offset4.xq - :) -declare function excel:offset( - $reference as xs:anyAtomicType+, - $reference_height as xs:integer, - $reference_width as xs:integer, - $rows as xs:integer, - $cols as xs:integer, - $height as xs:integer, - $width as xs:integer) as xs:anyAtomicType* -{ - if ($rows lt 0 or $cols lt 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Offset function: rows and cols must be positive or zero ", $rows * 1000 + $cols) - else if ($height lt 1 or $width lt 1) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Offset function: height and width must be greater than zero", $height * 1000 + $width) - else if (($reference_height * $reference_width) gt fn:count($reference)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Offset function: reference width and height not specified correctly ", $reference_width * 1000 + $reference_height) - else if (($rows + $height) gt $reference_height or - ($cols + $width) gt $reference_width) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Offset function: inner array is outside the reference array") - else - for $i in (1 to $height) - return - for $j in (1 to $width) - return - $reference[($rows + $i - 1) * $reference_width + $cols + $j] -}; - -(:~ - : Same as above, only that the sub-array is specified only by rows and cols relative position. - : The sub-array height and width is computed to contain the remaining elements of the array. - : - : @see http://office.microsoft.com/en-us/excel/HP052092081033.aspx - : @param $reference the reference array - : @param $reference_height the number of rows in the reference array - : @param $reference_width the number of elements in the reference array row - : @param $rows the relative row position where the sub-array starts. - : It must be a positive value, zero relative. - : @param $cols the relative column position where the sub-array starts. - : It must be a positive value, zero relative. - : @return The sequence specifying the sub-array, row after row - : @error excel-err:NA rows or cols are negative - : @error excel-err:NA height or width are smaller than 1 - : @error excel-err:Value reference array contains less elements than specified - : by reference_height and reference_width - : @error excel-err:NA the resulted sub-array is not completely contained inside reference array - : @example test/Queries/excel/lookup/offset1.xq - : @example test/Queries/excel/lookup/offset2.xq - :) -declare function excel:offset( - $reference as xs:anyAtomicType+, - $reference_height as xs:integer, - $reference_width as xs:integer, - $rows as xs:integer, - $cols as xs:integer) as xs:anyAtomicType* -{ - excel:offset($reference, $reference_height, $reference_width, - $rows, $cols, - $reference_height - $rows, $reference_width - $cols) -}; - -(:~ - : Transposes an array. The rows become columns and vice versa. - : - : @see http://office.microsoft.com/en-us/excel/HP052093191033.aspx - : @param $array the sequence specifying the array, row after row - : @param $array_width the number of elements in a row - : @param $array_height the number of rows in the array - : @return The transposed array. It will be a sequence specifying an array, row after row. - : The result width is the input height. - : The result height is the input width. - : @error excel-err:Value the array contains less elements than specified by array_width and array_height - : @example test/Queries/excel/lookup/transpose1.xq - : @example test/Queries/excel/lookup/transpose2.xq - :) -declare function excel:transpose( - $array as xs:anyAtomicType+, - $array_width as xs:integer, - $array_height as xs:integer) as xs:anyAtomicType+ -{ - if (($array_height * $array_width) gt fn:count($array)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Transpose function: array width and height not specified correctly ", $array_width * 1000 + $array_height) - else - for $c in (1 to $array_width) - return - for $r in (1 to $array_height) - return - $array[($r - 1) * $array_width + $c] -}; - -(:~ - : Searches for a value in the first column of a table array - : and returns a value in the same row from another column in the table array. - : - :
Array is specified with 3 parameters: - :
table_array
is a sequence of elements, first row first, then second row and so on
- :
table_width
specifies the number of elements in a row
- :
table_height
specifies the number of rows
- : - : For wildchar matching, the XQuery regex matcher is used. - : - : @see http://office.microsoft.com/en-us/excel/HP052093351033.aspx - : @param $lookup_value the value to be searched. - : Allowed types are numeric, string, boolean.
- : Boolean values are compared only with booleans. - : Numbers are compared only with numbers, if range_lookup is not zero. - : The other types are converted to string and compared to string value of all values. - : @param $table_array the sequence of values, row after row - : @param $table_width the number of values in a row - : @param $table_height the number of rows - : @param $col_index_num the row index, 1 based - : @param $range_lookup
specified the algorithm to use: - :
true
find approximative match. - : First column of array must be sorted in ascending order.
- :
false
find exact match, using xquery regex. - : First column of array can be in any order.
- : @return The value found, with original type - : @error excel-err:Value if the array contains less elements than specified by table_height and table_width - : @error excel-err:Value if col_index_num is outside the range 1 .. table_height - : @error excel-err:Value if range_lookup is true and the value searched is smaller than - : the first value in the first column - : @error excel-err:Value if range_lookup=false and the value cannot be found - : @example test/Queries/excel/lookup/vlookup4.xq - :) -declare function excel:vlookup( - $lookup_value as xs:anyAtomicType, - $table_array as xs:anyAtomicType+, - $table_width as xs:integer, - $table_height as xs:integer, - $col_index_num as xs:integer, - $range_lookup as xs:boolean) as xs:anyAtomicType -{ - if ($table_height * $table_width gt fn:count($table_array)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Vlookup function: table array width and height not specified correctly ", $table_width * 1000 + $table_height) - else if ($col_index_num lt 1 or $col_index_num gt $table_width) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Vlookup function: col_index_num must be between 1 and table width ", $col_index_num) - else - let $table_header := ( - for $i in (1 to $table_height) - return - $table_array[($i - 1) * $table_width + 1] - ) - let $row := excel:lookup-column($lookup_value, $table_header, $range_lookup cast as xs:integer, 0, 0) - return - if ($row eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Vlookup function: lookup value cannot be matched", $lookup_value) - else if ($row gt $table_height) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Vlookup function: row found outside table array ", $row) - else - $table_array[($row - 1) * $table_width + $col_index_num] -}; - -(:~ - : Same as above, with range_lookup defaulted to true. - : It finds the largest value that is less than or equal to lookup_value. - : First column must be in ascending order. - : - : @see http://office.microsoft.com/en-us/excel/HP052093351033.aspx - : @param $lookup_value the value to be searched. - : Allowed types are numeric, string, boolean.
- : Boolean values are compared only with booleans. - : Numbers are compared only with numbers, if range_lookup is not zero. - : The other types are converted to string and compared to string value of all values. - : @param $table_array the sequence of values, row after row - : @param $table_width the number of values in a row - : @param $table_height the number of rows - : @param $col_index_num the row index, 1 based - : @return The value found, with original type - : @error excel-err:Value if the array contains less elements than specified by table_height and table_width - : @error excel-err:Value if col_index_num is outside the range 1 .. table_height - : @error excel-err:Value if range_lookup is true and the value searched is smaller than - : the first value in the first column - : @error excel-err:Value if range_lookup=false and the value cannot be found - : @example test/Queries/excel/lookup/vlookup1.xq - : @example test/Queries/excel/lookup/vlookup2.xq - : @example test/Queries/excel/lookup/vlookup3.xq - : @example test/Queries/excel/lookup/vlookup5.xq - :) -declare function excel:vlookup( - $lookup_value as xs:anyAtomicType, - $table_array as xs:anyAtomicType+, - $table_width as xs:integer, - $table_height as xs:integer, - $col_index_num as xs:integer) as xs:anyAtomicType -{ - excel:vlookup($lookup_value, $table_array, $table_width, $table_height, - $col_index_num, fn:true()) -}; diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/math-sumproduct.xq zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/math-sumproduct.xq --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/math-sumproduct.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/math-sumproduct.xq 1970-01-01 00:00:00.000000000 +0000 @@ -1,2802 +0,0 @@ -xquery version "3.0"; - -(: - : Copyright 2006-2009 The FLWOR Foundation. - : - : Licensed under the Apache License, Version 2.0 (the "License"); - : you may not use this file except in compliance with the License. - : You may obtain a copy of the License at - : - : http://www.apache.org/licenses/LICENSE-2.0 - : - : Unless required by applicable law or agreed to in writing, software - : distributed under the License is distributed on an "AS IS" BASIS, - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - : See the License for the specific language governing permissions and - : limitations under the License. -:) - -(:~ - : Module implementing the sumproduct functions from Excel 2003 math library. - : There are 30 functions defined, implementing the same function - : but with 1 to 30 parameters. - : Each parameter can be a sequence of infinite length. - : - : @see Excel 2003 Documentation: Math-sumproduct Functions - : - : @author Daniel Turcanu - : @project Zorba/Excel/Math Sumproduct - : - :) -module namespace excel = "http://www.zorba-xquery.com/modules/excel/math-sumproduct"; - -(:~ - : Import excel-math module functions. -:) -import module namespace excel-math = "http://www.zorba-xquery.com/modules/excel/math"; - -declare namespace excel-err = "http://www.zorba-xquery.com/modules/excel/errors"; - -declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; -declare option ver:module-version "1.0"; - - -(:~ - : Sums the values in the sequence. - : The sequence can be of any length. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequence of numbers or arguments castable to numeric - : @return the sum - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/math/sumproduct1.xq -:) -declare function excel:sumproduct( $array1 as xs:anyAtomicType*) as xs:anyAtomicType - { - excel-math:sum( $array1 ) - }; - -(:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/math/sumproduct2.xq -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) + excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/math/sumproduct3.xq -:) -declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2)) - }; - - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @param $array21 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType*, - $array21 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20) or - fn:empty($array21)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) * - excel-math:cast-as-numeric($array21[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2), - fn:subsequence($array21,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @param $array21 the sequences of numbers or arguments castable to numeric - : @param $array22 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType*, - $array21 as xs:anyAtomicType*, - $array22 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20) or - fn:empty($array21) or - fn:empty($array22)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) * - excel-math:cast-as-numeric($array21[1]) * - excel-math:cast-as-numeric($array22[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2), - fn:subsequence($array21,2), - fn:subsequence($array22,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @param $array21 the sequences of numbers or arguments castable to numeric - : @param $array22 the sequences of numbers or arguments castable to numeric - : @param $array23 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType*, - $array21 as xs:anyAtomicType*, - $array22 as xs:anyAtomicType*, - $array23 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20) or - fn:empty($array21) or - fn:empty($array22) or - fn:empty($array23)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) * - excel-math:cast-as-numeric($array21[1]) * - excel-math:cast-as-numeric($array22[1]) * - excel-math:cast-as-numeric($array23[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2), - fn:subsequence($array21,2), - fn:subsequence($array22,2), - fn:subsequence($array23,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @param $array21 the sequences of numbers or arguments castable to numeric - : @param $array22 the sequences of numbers or arguments castable to numeric - : @param $array23 the sequences of numbers or arguments castable to numeric - : @param $array24 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType*, - $array21 as xs:anyAtomicType*, - $array22 as xs:anyAtomicType*, - $array23 as xs:anyAtomicType*, - $array24 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20) or - fn:empty($array21) or - fn:empty($array22) or - fn:empty($array23) or - fn:empty($array24)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) * - excel-math:cast-as-numeric($array21[1]) * - excel-math:cast-as-numeric($array22[1]) * - excel-math:cast-as-numeric($array23[1]) * - excel-math:cast-as-numeric($array24[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2), - fn:subsequence($array21,2), - fn:subsequence($array22,2), - fn:subsequence($array23,2), - fn:subsequence($array24,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @param $array21 the sequences of numbers or arguments castable to numeric - : @param $array22 the sequences of numbers or arguments castable to numeric - : @param $array23 the sequences of numbers or arguments castable to numeric - : @param $array24 the sequences of numbers or arguments castable to numeric - : @param $array25 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType*, - $array21 as xs:anyAtomicType*, - $array22 as xs:anyAtomicType*, - $array23 as xs:anyAtomicType*, - $array24 as xs:anyAtomicType*, - $array25 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20) or - fn:empty($array21) or - fn:empty($array22) or - fn:empty($array23) or - fn:empty($array24) or - fn:empty($array25)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) * - excel-math:cast-as-numeric($array21[1]) * - excel-math:cast-as-numeric($array22[1]) * - excel-math:cast-as-numeric($array23[1]) * - excel-math:cast-as-numeric($array24[1]) * - excel-math:cast-as-numeric($array25[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2), - fn:subsequence($array21,2), - fn:subsequence($array22,2), - fn:subsequence($array23,2), - fn:subsequence($array24,2), - fn:subsequence($array25,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @param $array21 the sequences of numbers or arguments castable to numeric - : @param $array22 the sequences of numbers or arguments castable to numeric - : @param $array23 the sequences of numbers or arguments castable to numeric - : @param $array24 the sequences of numbers or arguments castable to numeric - : @param $array25 the sequences of numbers or arguments castable to numeric - : @param $array26 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType*, - $array21 as xs:anyAtomicType*, - $array22 as xs:anyAtomicType*, - $array23 as xs:anyAtomicType*, - $array24 as xs:anyAtomicType*, - $array25 as xs:anyAtomicType*, - $array26 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20) or - fn:empty($array21) or - fn:empty($array22) or - fn:empty($array23) or - fn:empty($array24) or - fn:empty($array25) or - fn:empty($array26)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) * - excel-math:cast-as-numeric($array21[1]) * - excel-math:cast-as-numeric($array22[1]) * - excel-math:cast-as-numeric($array23[1]) * - excel-math:cast-as-numeric($array24[1]) * - excel-math:cast-as-numeric($array25[1]) * - excel-math:cast-as-numeric($array26[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2), - fn:subsequence($array21,2), - fn:subsequence($array22,2), - fn:subsequence($array23,2), - fn:subsequence($array24,2), - fn:subsequence($array25,2), - fn:subsequence($array26,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @param $array21 the sequences of numbers or arguments castable to numeric - : @param $array22 the sequences of numbers or arguments castable to numeric - : @param $array23 the sequences of numbers or arguments castable to numeric - : @param $array24 the sequences of numbers or arguments castable to numeric - : @param $array25 the sequences of numbers or arguments castable to numeric - : @param $array26 the sequences of numbers or arguments castable to numeric - : @param $array27 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType*, - $array21 as xs:anyAtomicType*, - $array22 as xs:anyAtomicType*, - $array23 as xs:anyAtomicType*, - $array24 as xs:anyAtomicType*, - $array25 as xs:anyAtomicType*, - $array26 as xs:anyAtomicType*, - $array27 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20) or - fn:empty($array21) or - fn:empty($array22) or - fn:empty($array23) or - fn:empty($array24) or - fn:empty($array25) or - fn:empty($array26) or - fn:empty($array27)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) * - excel-math:cast-as-numeric($array21[1]) * - excel-math:cast-as-numeric($array22[1]) * - excel-math:cast-as-numeric($array23[1]) * - excel-math:cast-as-numeric($array24[1]) * - excel-math:cast-as-numeric($array25[1]) * - excel-math:cast-as-numeric($array26[1]) * - excel-math:cast-as-numeric($array27[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2), - fn:subsequence($array21,2), - fn:subsequence($array22,2), - fn:subsequence($array23,2), - fn:subsequence($array24,2), - fn:subsequence($array25,2), - fn:subsequence($array26,2), - fn:subsequence($array27,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @param $array21 the sequences of numbers or arguments castable to numeric - : @param $array22 the sequences of numbers or arguments castable to numeric - : @param $array23 the sequences of numbers or arguments castable to numeric - : @param $array24 the sequences of numbers or arguments castable to numeric - : @param $array25 the sequences of numbers or arguments castable to numeric - : @param $array26 the sequences of numbers or arguments castable to numeric - : @param $array27 the sequences of numbers or arguments castable to numeric - : @param $array28 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType*, - $array21 as xs:anyAtomicType*, - $array22 as xs:anyAtomicType*, - $array23 as xs:anyAtomicType*, - $array24 as xs:anyAtomicType*, - $array25 as xs:anyAtomicType*, - $array26 as xs:anyAtomicType*, - $array27 as xs:anyAtomicType*, - $array28 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20) or - fn:empty($array21) or - fn:empty($array22) or - fn:empty($array23) or - fn:empty($array24) or - fn:empty($array25) or - fn:empty($array26) or - fn:empty($array27) or - fn:empty($array28)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) * - excel-math:cast-as-numeric($array21[1]) * - excel-math:cast-as-numeric($array22[1]) * - excel-math:cast-as-numeric($array23[1]) * - excel-math:cast-as-numeric($array24[1]) * - excel-math:cast-as-numeric($array25[1]) * - excel-math:cast-as-numeric($array26[1]) * - excel-math:cast-as-numeric($array27[1]) * - excel-math:cast-as-numeric($array28[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2), - fn:subsequence($array21,2), - fn:subsequence($array22,2), - fn:subsequence($array23,2), - fn:subsequence($array24,2), - fn:subsequence($array25,2), - fn:subsequence($array26,2), - fn:subsequence($array27,2), - fn:subsequence($array28,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @param $array21 the sequences of numbers or arguments castable to numeric - : @param $array22 the sequences of numbers or arguments castable to numeric - : @param $array23 the sequences of numbers or arguments castable to numeric - : @param $array24 the sequences of numbers or arguments castable to numeric - : @param $array25 the sequences of numbers or arguments castable to numeric - : @param $array26 the sequences of numbers or arguments castable to numeric - : @param $array27 the sequences of numbers or arguments castable to numeric - : @param $array28 the sequences of numbers or arguments castable to numeric - : @param $array29 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType*, - $array21 as xs:anyAtomicType*, - $array22 as xs:anyAtomicType*, - $array23 as xs:anyAtomicType*, - $array24 as xs:anyAtomicType*, - $array25 as xs:anyAtomicType*, - $array26 as xs:anyAtomicType*, - $array27 as xs:anyAtomicType*, - $array28 as xs:anyAtomicType*, - $array29 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20) or - fn:empty($array21) or - fn:empty($array22) or - fn:empty($array23) or - fn:empty($array24) or - fn:empty($array25) or - fn:empty($array26) or - fn:empty($array27) or - fn:empty($array28) or - fn:empty($array29)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) * - excel-math:cast-as-numeric($array21[1]) * - excel-math:cast-as-numeric($array22[1]) * - excel-math:cast-as-numeric($array23[1]) * - excel-math:cast-as-numeric($array24[1]) * - excel-math:cast-as-numeric($array25[1]) * - excel-math:cast-as-numeric($array26[1]) * - excel-math:cast-as-numeric($array27[1]) * - excel-math:cast-as-numeric($array28[1]) * - excel-math:cast-as-numeric($array29[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2), - fn:subsequence($array21,2), - fn:subsequence($array22,2), - fn:subsequence($array23,2), - fn:subsequence($array24,2), - fn:subsequence($array25,2), - fn:subsequence($array26,2), - fn:subsequence($array27,2), - fn:subsequence($array28,2), - fn:subsequence($array29,2)) - }; - - (:~ - : Multiplies the elements on the same position in each sequence - : and sums up the results. - : - : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx - : @param $array1 the sequences of numbers or arguments castable to numeric - : @param $array2 the sequences of numbers or arguments castable to numeric - : @param $array3 the sequences of numbers or arguments castable to numeric - : @param $array4 the sequences of numbers or arguments castable to numeric - : @param $array5 the sequences of numbers or arguments castable to numeric - : @param $array6 the sequences of numbers or arguments castable to numeric - : @param $array7 the sequences of numbers or arguments castable to numeric - : @param $array8 the sequences of numbers or arguments castable to numeric - : @param $array9 the sequences of numbers or arguments castable to numeric - : @param $array10 the sequences of numbers or arguments castable to numeric - : @param $array11 the sequences of numbers or arguments castable to numeric - : @param $array12 the sequences of numbers or arguments castable to numeric - : @param $array13 the sequences of numbers or arguments castable to numeric - : @param $array14 the sequences of numbers or arguments castable to numeric - : @param $array15 the sequences of numbers or arguments castable to numeric - : @param $array16 the sequences of numbers or arguments castable to numeric - : @param $array17 the sequences of numbers or arguments castable to numeric - : @param $array18 the sequences of numbers or arguments castable to numeric - : @param $array19 the sequences of numbers or arguments castable to numeric - : @param $array20 the sequences of numbers or arguments castable to numeric - : @param $array21 the sequences of numbers or arguments castable to numeric - : @param $array22 the sequences of numbers or arguments castable to numeric - : @param $array23 the sequences of numbers or arguments castable to numeric - : @param $array24 the sequences of numbers or arguments castable to numeric - : @param $array25 the sequences of numbers or arguments castable to numeric - : @param $array26 the sequences of numbers or arguments castable to numeric - : @param $array27 the sequences of numbers or arguments castable to numeric - : @param $array28 the sequences of numbers or arguments castable to numeric - : @param $array29 the sequences of numbers or arguments castable to numeric - : @param $array30 the sequences of numbers or arguments castable to numeric - : @return the sum of products - : @error excel-err:Value if the parameters cannot be casted to numeric type -:) - declare function excel:sumproduct( $array1 as xs:anyAtomicType*, - $array2 as xs:anyAtomicType*, - $array3 as xs:anyAtomicType*, - $array4 as xs:anyAtomicType*, - $array5 as xs:anyAtomicType*, - $array6 as xs:anyAtomicType*, - $array7 as xs:anyAtomicType*, - $array8 as xs:anyAtomicType*, - $array9 as xs:anyAtomicType*, - $array10 as xs:anyAtomicType*, - $array11 as xs:anyAtomicType*, - $array12 as xs:anyAtomicType*, - $array13 as xs:anyAtomicType*, - $array14 as xs:anyAtomicType*, - $array15 as xs:anyAtomicType*, - $array16 as xs:anyAtomicType*, - $array17 as xs:anyAtomicType*, - $array18 as xs:anyAtomicType*, - $array19 as xs:anyAtomicType*, - $array20 as xs:anyAtomicType*, - $array21 as xs:anyAtomicType*, - $array22 as xs:anyAtomicType*, - $array23 as xs:anyAtomicType*, - $array24 as xs:anyAtomicType*, - $array25 as xs:anyAtomicType*, - $array26 as xs:anyAtomicType*, - $array27 as xs:anyAtomicType*, - $array28 as xs:anyAtomicType*, - $array29 as xs:anyAtomicType*, - $array30 as xs:anyAtomicType* ) as xs:anyAtomicType - { - if( fn:empty($array1) or - fn:empty($array2) or - fn:empty($array3) or - fn:empty($array4) or - fn:empty($array5) or - fn:empty($array6) or - fn:empty($array7) or - fn:empty($array8) or - fn:empty($array9) or - fn:empty($array10) or - fn:empty($array11) or - fn:empty($array12) or - fn:empty($array13) or - fn:empty($array14) or - fn:empty($array15) or - fn:empty($array16) or - fn:empty($array17) or - fn:empty($array18) or - fn:empty($array19) or - fn:empty($array20) or - fn:empty($array21) or - fn:empty($array22) or - fn:empty($array23) or - fn:empty($array24) or - fn:empty($array25) or - fn:empty($array26) or - fn:empty($array27) or - fn:empty($array28) or - fn:empty($array29) or - fn:empty($array30)) - then - 0 - else - excel-math:cast-as-numeric($array1[1]) * - excel-math:cast-as-numeric($array2[1]) * - excel-math:cast-as-numeric($array3[1]) * - excel-math:cast-as-numeric($array4[1]) * - excel-math:cast-as-numeric($array5[1]) * - excel-math:cast-as-numeric($array6[1]) * - excel-math:cast-as-numeric($array7[1]) * - excel-math:cast-as-numeric($array8[1]) * - excel-math:cast-as-numeric($array9[1]) * - excel-math:cast-as-numeric($array10[1]) * - excel-math:cast-as-numeric($array11[1]) * - excel-math:cast-as-numeric($array12[1]) * - excel-math:cast-as-numeric($array13[1]) * - excel-math:cast-as-numeric($array14[1]) * - excel-math:cast-as-numeric($array15[1]) * - excel-math:cast-as-numeric($array16[1]) * - excel-math:cast-as-numeric($array17[1]) * - excel-math:cast-as-numeric($array18[1]) * - excel-math:cast-as-numeric($array19[1]) * - excel-math:cast-as-numeric($array20[1]) * - excel-math:cast-as-numeric($array21[1]) * - excel-math:cast-as-numeric($array22[1]) * - excel-math:cast-as-numeric($array23[1]) * - excel-math:cast-as-numeric($array24[1]) * - excel-math:cast-as-numeric($array25[1]) * - excel-math:cast-as-numeric($array26[1]) * - excel-math:cast-as-numeric($array27[1]) * - excel-math:cast-as-numeric($array28[1]) * - excel-math:cast-as-numeric($array29[1]) * - excel-math:cast-as-numeric($array30[1]) + - excel:sumproduct( fn:subsequence($array1,2), - fn:subsequence($array2,2), - fn:subsequence($array3,2), - fn:subsequence($array4,2), - fn:subsequence($array5,2), - fn:subsequence($array6,2), - fn:subsequence($array7,2), - fn:subsequence($array8,2), - fn:subsequence($array9,2), - fn:subsequence($array10,2), - fn:subsequence($array11,2), - fn:subsequence($array12,2), - fn:subsequence($array13,2), - fn:subsequence($array14,2), - fn:subsequence($array15,2), - fn:subsequence($array16,2), - fn:subsequence($array17,2), - fn:subsequence($array18,2), - fn:subsequence($array19,2), - fn:subsequence($array20,2), - fn:subsequence($array21,2), - fn:subsequence($array22,2), - fn:subsequence($array23,2), - fn:subsequence($array24,2), - fn:subsequence($array25,2), - fn:subsequence($array26,2), - fn:subsequence($array27,2), - fn:subsequence($array28,2), - fn:subsequence($array29,2), - fn:subsequence($array30,2)) - }; - -(:~ - : Returns the sum of the squares of the arguments. - : It used the sumproduct function. - : - : @see http://office.microsoft.com/en-us/excel/HP052092951033.aspx - : @param $numbers the sequence of one or more numbers or arguments castable to numeric - : @return the sum of squared values, as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/math/sumsq1.xq -:) - declare function excel:sumsq( $numbers as xs:anyAtomicType+) as xs:anyAtomicType - { - excel:sumproduct($numbers, $numbers) - }; - diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/math.xq zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/math.xq --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/math.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/math.xq 1970-01-01 00:00:00.000000000 +0000 @@ -1,957 +0,0 @@ -xquery version "3.0"; - -(: - : Copyright 2006-2009 The FLWOR Foundation. - : - : Licensed under the Apache License, Version 2.0 (the "License"); - : you may not use this file except in compliance with the License. - : You may obtain a copy of the License at - : - : http://www.apache.org/licenses/LICENSE-2.0 - : - : Unless required by applicable law or agreed to in writing, software - : distributed under the License is distributed on an "AS IS" BASIS, - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - : See the License for the specific language governing permissions and - : limitations under the License. - :) - -(:~ - : This is a library module offering a part of the set of functions - : defined by Microsoft Excel 2003. - : - : @see Excel 2003 Documentation: Math Functions - : - : @author Daniel Turcanu - : @project Zorba/Excel/Math - : - :) -module namespace excel = "http://www.zorba-xquery.com/modules/excel/math" ; - -declare namespace excel-err = "http://www.zorba-xquery.com/modules/excel/errors"; - -declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; -declare option ver:module-version "1.0"; - -(:~ - : Checks if the xs:anyAtomicType argument is actually a numeric type - : or can be converted to numeric. - : - : @param $value Parameter to be checked. - : @return true if the value can be casted to numeric. - :) -declare function excel:is-a-number($value as xs:anyAtomicType) as xs:boolean -{ - fn:string(fn:number($value)) ne 'NaN' -}; - -(:~ - : Cast the xs:anyAtomicType to a numeric type. - : If the value is already of a numeric type then nothing is changed. - : Otherwise the value is casted to the numeric type that is most appropriate. - : - : @param $number The parameter can be a number, string, boolean value. - : @return The casted value. - : @error excel-err:Value if the value cannot be casted to numeric type. - :) -declare function excel:cast-as-numeric($number as xs:anyAtomicType) as xs:anyAtomicType -{ - typeswitch ($number) - case xs:double return $number - case xs:decimal return $number - case xs:double return $number - case xs:float return $number - default return - if ($number castable as xs:integer) then - xs:integer($number) - else if ($number castable as xs:decimal) then - xs:decimal($number) - else if ($number castable as xs:double) then - xs:double($number) - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value is not a number", $number) -}; - -(: ---------------- Excel Math functions ----------------------- :) - -(:~ - : Compute the abs of a numeric value. - : The value can also be a string and it will be casted to the appropriate numeric first. - : - : @see http://office.microsoft.com/en-us/excel/HP052089781033.aspx - : @param $arg The parameter can be a number, string, boolean value. - : @return The abs value as a numeric type. - : @error excel-err:Value if arg cannot be casted to numeric type. - : @example test/Queries/excel/math/abs1.xq - : @example test/Queries/excel/math/abs2.xq - : @example test/Queries/excel/math/abs3.xq - : @example test/Queries/excel/math/abs4.xq - : @example test/Queries/excel/math/abs5.xq - : @example test/Queries/excel/math/abs6.xq - :) -declare function excel:abs($arg as xs:anyAtomicType) as xs:anyAtomicType -{ - fn:abs(excel:cast-as-numeric($arg)) -}; - -(:~ - : Returns number rounded up, away from zero, to the nearest multiple of significance. - : Significance must have the same sign as number. - : Number and significance must be of a numeric type or castable to numeric. - : Significance must not be zero. - : - : @see http://office.microsoft.com/en-us/excel/HP052090071033.aspx - : @param $number The value you want to round. - : @param $significance The multiple to which you want to round. - : @return The rounded value. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @error excel-err:Num if significance is zero or it doesn't have the same sign as number. - : @example test/Queries/excel/math/ceiling1.xq - : @example test/Queries/excel/math/ceiling2.xq - : @example test/Queries/excel/math/ceiling3.xq - : @example test/Queries/excel/math/ceiling4.xq - : @example test/Queries/excel/math/ceiling5.xq - : @example test/Queries/excel/math/ceiling6.xq - : @example test/Queries/excel/math/ceiling7.xq - :) -declare function excel:ceiling( - $number as xs:anyAtomicType, - $significance as xs:anyAtomicType) as xs:anyAtomicType -{ - let $num := excel:cast-as-numeric($number) - let $sig := excel:cast-as-numeric($significance) - return - if ($sig eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Ceiling function does not accept significance 0") - else if ($num * $sig ge 0) then - fn:ceiling($num div $sig) * $sig - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Ceiling function: both arguments must have the same sign") -}; - -(:~ - : Returns number rounded up to the nearest even integer. - : Regardless of the sign of number, a value is rounded up when adjusted away from zero. - : - : @see http://office.microsoft.com/en-us/excel/HP052090801033.aspx - : @param $number The value to round. - : @return The rounded value casted as numeric type. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @example test/Queries/excel/math/even1.xq - : @example test/Queries/excel/math/even2.xq - : @example test/Queries/excel/math/even3.xq - : @example test/Queries/excel/math/even4.xq - : @example test/Queries/excel/math/even5.xq - : @example test/Queries/excel/math/even6.xq - :) -declare function excel:even($number as xs:anyAtomicType) as xs:anyAtomicType -{ - let $num := excel:cast-as-numeric($number) - return - if ($num = 0) then - 0 - else - let $intnum := excel:ceiling($num, excel:sign($num)) - return - if ($intnum mod 2 ne 0) then - if ($intnum gt 0) then - $intnum + 1 - else - $intnum - 1 - else - $intnum -}; - -(:~ - : Function for computing factorial. - : This function should not be used outside this module. - : This recursive function computes: number * fact(number-1) - : - : @param $intnum A positive integer. - : @return The factorial of intnum. -:) -declare %private function excel:fact-integer($intnum as xs:integer) as xs:integer -{ - if ($intnum = 1) then - 1 - else - $intnum * excel:fact-integer($intnum - 1) -}; - -(:~ - : Returns the factorial of a number. - : - : @see http://office.microsoft.com/en-us/excel/HP052090841033.aspx - : @param $number The nonnegative number you want the factorial of. - : If number is not an integer, it is truncated. - : @return Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number. - : @error excel-err:Num if the number is smaller than zero - : @example test/Queries/excel/math/fact1.xq - : @example test/Queries/excel/math/fact2.xq - : @example test/Queries/excel/math/fact3.xq - : @example test/Queries/excel/math/fact4.xq - : @example test/Queries/excel/math/fact5.xq -:) -declare function excel:fact($number as xs:anyAtomicType) as xs:integer -{ - let $num := excel:cast-as-numeric($number) return - if ($num eq 0) then - 1 - else - if ($num lt 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Fact function does not accept numbers less than zero") - else - excel:fact-integer(xs:integer($num)) -}; - -(:~ - : Rounds number down, toward zero, to the nearest multiple of significance. - : Significance must have the same sign as number. - : - : @see http://office.microsoft.com/en-us/excel/HP052090941033.aspx - : @param $number The value you want to round. The value is casted to numeric. - : @param $significance The multiple to which you want to round. - : @return The rounded value as numeric type. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @error excel-err:Num if significance is zero or it doesn't have the same sign as number. - : @example test/Queries/excel/math/floor1.xq - : @example test/Queries/excel/math/floor2.xq - : @example test/Queries/excel/math/floor3.xq - : @example test/Queries/excel/math/floor4.xq - : @example test/Queries/excel/math/floor5.xq -:) -declare function excel:floor( - $number as xs:anyAtomicType, - $significance as xs:anyAtomicType) as xs:anyAtomicType -{ - let $num := excel:cast-as-numeric($number) - let $sig := excel:cast-as-numeric($significance) - return - if ($sig eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Floor function does not accept significance 0") - else if ($num * $sig ge 0) then - fn:floor($num div $sig) * $sig - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Floor function: both arguments must have the same sign") -}; - -(:~ - : Rounds a number down to the nearest integer. - : Positive numbers are rounded toward zero, negative numbers are rounded away from zero. - : - : @see http://office.microsoft.com/en-us/excel/HP052091421033.aspx - : @param $number The value to be rounded. - : @return The rounded integer. - : @error excel-err:Value if parameter cannot be casted to numeric type - : @example test/Queries/excel/math/int1.xq - : @example test/Queries/excel/math/int2.xq - : @example test/Queries/excel/math/int3.xq - : @example test/Queries/excel/math/int4.xq -:) -declare function excel:int($number as xs:anyAtomicType) as xs:integer -{ - xs:integer(fn:floor(excel:cast-as-numeric($number))) -}; - -(:~ - : Returns the remainder after number is divided by divisor. - : The result has the same sign as divisor. - : - : @see http://office.microsoft.com/en-us/excel/HP052091821033.aspx - : @param $number The number for which you want to find the remainder. - : @param $divisor The number by which you want to divide number. - : This cannot be zero. - : @return The remainder from division as numeric type. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @error excel-err:Div0 if divisor is zero after casting to numeric. - : @example test/Queries/excel/math/mod1.xq - : @example test/Queries/excel/math/mod2.xq - : @example test/Queries/excel/math/mod3.xq - : @example test/Queries/excel/math/mod4.xq - :) -declare function excel:mod( - $number as xs:anyAtomicType, - $divisor as xs:anyAtomicType) as xs:anyAtomicType -{ - let $num := excel:cast-as-numeric($number) - let $div := excel:cast-as-numeric($divisor) return - if ($div eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Div0"), "Mod operator: divide by 0") - else - let $result := $num mod $div - return - if ($result * $div lt 0) then - -$result - else - $result -}; - -(:~ - : Returns number rounded up to the nearest odd integer, away from zero. - : - : @see http://office.microsoft.com/en-us/excel/HP052092031033.aspx - : @param $number The value to round. - : @return The odd integer. - : @error excel-err:Value if parameter cannot be casted to numeric type. - : @example test/Queries/excel/math/odd1.xq - : @example test/Queries/excel/math/odd2.xq - : @example test/Queries/excel/math/odd3.xq - : @example test/Queries/excel/math/odd4.xq - : @example test/Queries/excel/math/odd5.xq - : @example test/Queries/excel/math/odd6.xq - :) -declare function excel:odd($number as xs:anyAtomicType) as xs:integer -{ - let $num := excel:cast-as-numeric($number) return - if ($num eq 0) then - 1 - else - let $intnum := excel:ceiling($num, excel:sign($num)) - return - if ($intnum mod 2 eq 0) then - if ($intnum ge 0) then - ($intnum + 1) cast as xs:integer - else - ($intnum - 1) cast as xs:integer - else - $intnum cast as xs:integer -}; - -(:~ - : Return the value of PI as decimal with 15 digits. - : - : @see http://office.microsoft.com/en-us/excel/HP052092141033.aspx - : @return The value of PI with 15 digits. - :) -declare function excel:pi() as xs:decimal -{ - 3.14159265358979 -}; - -(:~ - : Returns the result of a number raised to a power. - : The result is computed through successive multiplications. - : - : @see http://office.microsoft.com/en-us/excel/HP052092171033.aspx - : @param $number The base number. - : @param $power The exponent as integer (cannot be floating point like in Excel). - : @return The result as numeric type. - : @error excel-err:Value if parameter cannot be casted to numeric type. - : @error excel-err:Value if power is smaller than zero. - : @example test/Queries/excel/math/power1.xq - : @example test/Queries/excel/math/power3.xq - : @example test/Queries/excel/math/power4.xq - : @example test/Queries/excel/math/power5.xq - :) -declare function excel:power( - $number as xs:anyAtomicType, - $power as xs:integer) as xs:anyAtomicType -{ - let $num := excel:cast-as-numeric($number) - return - if ($power lt 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Power function: power must be greater or equal than zero") - else if ($power eq 0) then - 1 - else if ($power = 1) then - $num - else - let $retval := excel:power($num, $power idiv 2) - return - $retval * $retval * excel:power($num, $power mod 2) - }; - -(:~ - : Function for product. - : This function should not be used outside this module. - : Multiplies all numbers in the sequence. - : - : @param $numbers The list of arguments to be casted to numeric and multiplied. - : @return The multiplication result as numeric type. - : @error excel-err:Value if parameters cannot be casted to numeric type. - :) -declare %private function excel:product-internal($numbers as xs:anyAtomicType*) as xs:anyAtomicType -{ - if (fn:empty($numbers)) then - 1 - else - let $x := excel:cast-as-numeric($numbers[1]) - return - $x * excel:product-internal(fn:subsequence($numbers, 2)) -}; - -(:~ - : Multiplies all the numbers given as arguments and returns the product. - : - : @see http://office.microsoft.com/en-us/excel/HP052092231033.aspx - : @param $numbers The sequence of arguments convertable to numeric types. - : The sequence can be of any length. - : @return The multiplication result as numeric type. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @example test/Queries/excel/math/product1.xq - : @example test/Queries/excel/math/product2.xq - : @example test/Queries/excel/math/product3.xq - : @example test/Queries/excel/math/product4.xq - : @example test/Queries/excel/math/product5.xq - :) -declare function excel:product($numbers as xs:anyAtomicType*) as xs:anyAtomicType -{ - if (fn:empty($numbers)) then - 0 - else - excel:product-internal($numbers) -}; - -(:~ - : Returns the integer portion of a division. - : - : @see http://office.microsoft.com/en-us/excel/HP052092271033.aspx - : @param $numerator The divident. - : @param $denominator The divisor. It cannot be zero. - : @return The result value as numeric type. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @error excel-err:Div0 if denominator casted as numeric type has value zero. - : @example test/Queries/excel/math/quotient1.xq - : @example test/Queries/excel/math/quotient2.xq - : @example test/Queries/excel/math/quotient3.xq - : @example test/Queries/excel/math/quotient4.xq - :) -declare function excel:quotient( - $numerator as xs:anyAtomicType, - $denominator as xs:anyAtomicType) as xs:integer -{ - let $numer := excel:cast-as-numeric($numerator) - let $denom := excel:cast-as-numeric($denominator) - return - if ($denom eq 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Div0"), "Quotient function: divide by 0") - else - xs:integer($numer div $denom) -}; - -(:~ - : Rounds a number to a specified number of digits. - : If precision is greater than 0 (zero), then number is rounded - : to the specified number of decimal places. - : If num_digits is 0, then number is rounded to the nearest integer. - : If num_digits is less than 0, then number is rounded to the left of the decimal point. - : The 0.5 is rounded away from zero. - : - : @see http://office.microsoft.com/en-us/excel/HP052092391033.aspx - : @param $number The number to round, castable to a numeric type. - : @param $precision The number of decimal places to keep. - : @return The rounded number as numeric type. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @example test/Queries/excel/math/round1.xq - : @example test/Queries/excel/math/round2.xq - : @example test/Queries/excel/math/round3.xq - : @example test/Queries/excel/math/round4.xq - :) -declare function excel:round( - $number as xs:anyAtomicType, - $precision as xs:integer) as xs:anyAtomicType -{ - let $num := excel:cast-as-numeric($number) - return - if ($precision ge 0) then - let $exp_prec := excel:power(10, $precision) - return - if ($num ge 0) then - fn:floor($num * $exp_prec + 0.5) div $exp_prec - else - -fn:floor(-$num * $exp_prec + 0.5) div $exp_prec - else - let $exp_prec := excel:power(10, -$precision) - return - if ($num ge 0) then - fn:floor($num div $exp_prec + 0.5) * $exp_prec - else - -fn:floor(-$num div $exp_prec + 0.5) * $exp_prec -}; - -(:~ - : Rounds a number down, toward zero. - : If num_digits is greater than 0 (zero), then number is rounded down - : to the specified number of decimal places. - : If num_digits is 0, then number is rounded down to the nearest integer. - : If num_digits is less than 0, then number is rounded down to the left of the decimal point. - : - : @see http://office.microsoft.com/en-us/excel/HP052092411033.aspx - : @param $number The number to round, castable to numeric type. - : @param $precision The number of decimal places to keep. - : @return the truncated number toward zero, as numeric type. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @example test/Queries/excel/math/rounddown1.xq - : @example test/Queries/excel/math/rounddown2.xq - : @example test/Queries/excel/math/rounddown3.xq - : @example test/Queries/excel/math/rounddown4.xq - : @example test/Queries/excel/math/rounddown5.xq - :) -declare function excel:rounddown( - $number as xs:anyAtomicType, - $precision as xs:integer) as xs:anyAtomicType -{ - let $num := excel:cast-as-numeric($number) - return - if ($precision ge 0) then - let $exp_prec := excel:power(10, $precision) - return - if ($num ge 0) then - fn:floor($num * $exp_prec) div $exp_prec - else - -fn:floor(-$num * $exp_prec) div $exp_prec - else - let $exp_prec := excel:power(10, -$precision) - return - if ($num ge 0) then - fn:floor($num div $exp_prec) * $exp_prec - else - -fn:floor(-$num div $exp_prec) * $exp_prec -}; - -(:~ - : Rounds a number up, away from 0 (zero). - : If num_digits is greater than 0 (zero), then number is rounded down - : to the specified number of decimal places. - : If num_digits is 0, then number is rounded down to the nearest integer. - : If num_digits is less than 0, then number is rounded down to the left of the decimal point. - : - : @see http://office.microsoft.com/en-us/excel/HP052092421033.aspx - : @param $number The number to round, castable to numeric type. - : @param $precision The number of decimal places to keep. - : @return The truncated number away from zero, as numeric type. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @example test/Queries/excel/math/roundup1.xq - : @example test/Queries/excel/math/roundup2.xq - : @example test/Queries/excel/math/roundup3.xq - : @example test/Queries/excel/math/roundup4.xq - : @example test/Queries/excel/math/roundup5.xq - :) -declare function excel:roundup( - $number as xs:anyAtomicType, - $precision as xs:integer) as xs:anyAtomicType -{ - let $num := excel:cast-as-numeric($number) - return - if ($precision ge 0) then - let $exp_prec := excel:power(10, $precision) - return - if ($num ge 0) then - fn:ceiling($num * $exp_prec) div $exp_prec - else - -fn:ceiling(-$num * $exp_prec) div $exp_prec - else - let $exp_prec := excel:power(10, -$precision) - return - if ($num ge 0) then - fn:ceiling($num div $exp_prec) * $exp_prec - else - -fn:ceiling(-$num div $exp_prec) * $exp_prec -}; - -(:~ - : Determines the sign of a number. - : Returns 1 if the number is positive, zero (0) if the number is 0, - : and -1 if the number is negative. - : - : @see http://office.microsoft.com/en-us/excel/HP052092551033.aspx - : @param $number The argument castable to numeric type. - : @return The sign as (-1, 0, 1). - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @example test/Queries/excel/math/sign1.xq - : @example test/Queries/excel/math/sign2.xq - : @example test/Queries/excel/math/sign3.xq - :) -declare function excel:sign($number as xs:anyAtomicType) as xs:integer -{ - let $num := excel:cast-as-numeric($number) - return - if ($num eq 0) then - 0 - else if ($num gt 0) then - 1 - else - -1 - }; - -(:~ - : Adds all the numbers in the sequence. - : - : @see http://office.microsoft.com/en-us/excel/HP052092901033.aspx - : @param $numbers The sequence of arguments castable to numeric types. - : The sequence can be of any length. - : @return The sum as numeric type. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @example test/Queries/excel/math/sum1.xq - : @example test/Queries/excel/math/sum2.xq - : @example test/Queries/excel/math/sum3.xq - :) -declare function excel:sum($numbers as xs:anyAtomicType*) as xs:anyAtomicType -{ - if (fn:empty($numbers)) then - 0 - else - let $x := excel:cast-as-numeric($numbers[1]) - return - $x + excel:sum(fn:subsequence($numbers,2)) - }; - -(:~ - : Truncates a number to an integer by removing the fractional part of the number. - : - : @see http://office.microsoft.com/en-us/excel/HP052093241033.aspx - : @param $number The argument castable to numeric type. - : @return The integer value. - : @error excel-err:Value if parameter cannot be casted to numeric type. - : @example test/Queries/excel/math/trunc1.xq - : @example test/Queries/excel/math/trunc2.xq - :) -declare function excel:trunc($number as xs:anyAtomicType ) as xs:integer -{ - xs:integer(excel:cast-as-numeric($number)) -}; - -(:~ - : Truncates a number down to precision. - : This behaves exactly like rounddown. - : - : @see http://office.microsoft.com/en-us/excel/HP052093241033.aspx - : @param $number The argument castable to numeric type. - : @param $precision The number of decimal places to keep . - : @return The integer value. - : @error excel-err:Value if parameter cannot be casted to numeric type. - : @example test/Queries/excel/math/trunc3.xq - :) -declare function excel:trunc( - $number as xs:anyAtomicType, - $precision as xs:integer) as xs:anyAtomicType -{ - excel:rounddown(excel:cast-as-numeric($number), $precision) -}; - -(:~ - : Helper function.
- : Sorts a sequence of numbers or arguments castable to numeric. - : It first casts all arguments to numeric and then sorts ascending. - : - : @param $numbers The sequence of arguments castable to numeric. - : @return The sorted sequence as numeric types. - : @error excel-err:Value if parameters cannot be casted to numeric type. - :) -declare function excel:sort-numbers($numbers as xs:anyAtomicType*) as xs:anyAtomicType* -{ - let $sorted-numbers := - ( - for $number in $numbers - let $num := excel:cast-as-numeric($number) - order by $num - return $num - ) - return $sorted-numbers -}; - -(:~ - : Converts radians into degrees. - : - : @see http://office.microsoft.com/en-us/excel/HP052090561033.aspx - : @param $radian The value in radians. - : @return The value in degrees 0 .. 360 or 0 .. -360. - :) -declare function excel:degrees($radian as xs:double) as xs:integer -{ - xs:integer(($radian * 180 div excel:pi()) mod 360) -}; - -(:~ - : Returns the double factorial of a number. - : Computes the double factorial of n as n(n-2)(n-4)... - : - : @see http://office.microsoft.com/en-us/excel/HP052090851033.aspx - : @param $number The positive integer value. - : @return The result as integer. - : @error excel-err:Num if the number is negative. - : @example test/Queries/excel/math/priority1/factdouble1.xq - : @example test/Queries/excel/math/priority1/factdouble2.xq - :) -declare function excel:factdouble($number as xs:integer) as xs:integer -{ - if ($number lt 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Factdouble function: number should be greater than zero or equal") - else if ($number eq 1) then - 1 - else if ($number eq 2) then - 2 - else - $number * excel:factdouble($number - 2) -}; - -(:~ - : Function for computing GCD. - : This function should not be used outside this module. - : It calculates the minimum value from a sequence of positive integers, - : not taking into account the zero value. - : - : @param $numbers The sequence of positive integers. - : @return The minimum value. If the sequence contains only zero values, then zero is returned. - :) -declare %private function excel:min-without-zero($numbers as xs:integer+) as xs:integer -{ - if (fn:count($numbers) eq 1) then - $numbers[1] - else - let $min-other := excel:min-without-zero(fn:subsequence($numbers, 2)) - return - if ($numbers[1] eq 0) then - $min-other - else if ($min-other eq 0) then - $numbers[1] - else if ($numbers[1] lt $min-other) then - $numbers[1] - else - $min-other -}; - -(:~ - : Function for computing GCD. - : This function should not be used outside this module. - : Checks if all integer numbers from a sequence divide exactly to a divident. - : - : @param $numbers The positive integers. - : @param $divident The divident to be tried. - : @return true if the numbers divide exactly. -:) -declare %private function excel:try-exact-divide( - $numbers as xs:integer*, - $divident as xs:integer) as xs:boolean -{ - if (fn:empty($numbers)) then - fn:true() - else - if ($numbers[1] mod $divident ne 0) then - fn:false() - else - excel:try-exact-divide(fn:subsequence($numbers, 2), $divident) -}; - -(:~ - : Function for computing GCD. - : This function should not be used outside this module. - : This function iterates through possible divisors and checks if the sequence - : divides exactly to any of those. It starts from the minimum value from the - : sequence and searches downwards. - : - : @param $numbers The sequence of positive integers. - : @param $min-nonzero The minimum value of numbers sequence, excluding the zero value. - : @param $iteration Which iteration is it. It starts from 1 and continues - : to min-nonzero/2. - : @return The greatest common divisor if found, or 1 if not found. - :) -declare %private function excel:iterate-all-gcd( - $numbers as xs:integer*, - $min-nonzero as xs:integer, - $iteration as xs:integer) as xs:integer -{ - if ($min-nonzero mod $iteration eq 0) then - if (excel:try-exact-divide($numbers, $min-nonzero idiv $iteration)) then - $min-nonzero idiv $iteration - else - excel:iterate-all-gcd($numbers, $min-nonzero, $iteration + 1) - else - if ($iteration > $min-nonzero idiv 2) then - 1 - else - excel:iterate-all-gcd($numbers, $min-nonzero, $iteration + 1) -}; - -(:~ - : Returns the greatest common divisor GCD of a sequence of integers. - : The sequence can have one or more positive integers. - : - : @see http://office.microsoft.com/en-us/excel/HP052091041033.aspx - : @param $numbers The sequence of positive integers. - : @return The GCD as integer. - : @error excel-err:Num if any number is smaller than zero. - : @example test/Queries/excel/math/priority1/gcd1.xq - : @example test/Queries/excel/math/priority1/gcd2.xq - : @example test/Queries/excel/math/priority1/gcd3.xq - : @example test/Queries/excel/math/priority1/gcd4.xq - : @example test/Queries/excel/math/priority1/gcd5.xq - : @example test/Queries/excel/math/priority1/gcd6.xq - : @example test/Queries/excel/math/priority1/gcd7.xq - : @example test/Queries/excel/math/priority1/gcd8.xq - :) -declare function excel:gcd($numbers as xs:integer+) as xs:integer -{ - if (fn:count($numbers) = 1) then - $numbers[1] - else - let $minval := excel:min-without-zero($numbers) - return - if ($minval lt 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "gcd function: numbers should be greater than zero or equal") - else if ($minval eq 0) then - 0 - else - excel:iterate-all-gcd($numbers, $minval, 1) -}; - -(:~ - : Returns the least common multiple of integers.
- : LCM for two numbers is computed by multiplying them and dividing with GCD.
- : The function is applied recursively replacing the first two numbers in the sequence with their LCM. - : - : @see http://office.microsoft.com/en-us/excel/HP052091521033.aspx - : @param $numbers The sequence of one or more positive integers. - : @return The LCM as integer. - : @error excel-err:Num if any number is smaller than zero. - : @example test/Queries/excel/math/priority1/lcm1.xq - : @example test/Queries/excel/math/priority1/lcm2.xq - : @example test/Queries/excel/math/priority1/lcm3.xq - : @example test/Queries/excel/math/priority1/lcm4.xq - : @example test/Queries/excel/math/priority1/lcm5.xq - :) -declare function excel:lcm($numbers as xs:integer+) as xs:integer -{ - if(count($numbers) eq 1) then - $numbers[1] - else - if(count($numbers) eq 2) then - let $product := excel:product(fn:distinct-values($numbers)) - return - if ($product eq 0) then - 0 - else - $product idiv excel:gcd($numbers) - else - excel:lcm((excel:lcm(($numbers[1], $numbers[2])), subsequence($numbers, 3))) - -}; - -(:~ - : Returns a number rounded to the desired multiple. - : MROUND rounds up, away from zero, if the remainder of dividing number by multiple - : is greater than or equal to half the value of multiple. - : MROUND is computed through floor function. - : - : @see http://office.microsoft.com/en-us/excel/HP052091851033.aspx - : @param $number The value to round, castable to numeric type. - : @param $multiple The multiple to which you want to round number. - : @return The rounded number up to the desired multiple. - : @error excel-err:Value if parameters cannot be casted to numeric type. - : @example test/Queries/excel/math/priority1/mround1.xq - : @example test/Queries/excel/math/priority1/mround2.xq - : @example test/Queries/excel/math/priority1/mround3.xq - :) -declare function excel:mround( - $number as xs:anyAtomicType, - $multiple as xs:anyAtomicType) as xs:anyAtomicType -{ - let $num := excel:cast-as-numeric($number) - let $mul := excel:cast-as-numeric($multiple) - let $floor := excel:floor($num, $mul) return - if ($num ge 0) then - if (($num - $floor) ge ($mul div 2)) then - $floor + $mul - else - $floor - else - if ((-$num + $floor) ge (-$mul div 2)) then - $floor + $mul - else - $floor -}; - -(:~ - : Converts degrees to radians. - : - : @see http://office.microsoft.com/en-us/excel/HP052092281033.aspx - : @param $degree An angle in degrees that you want to convert. - : @return The value in radians. - : @example test/Queries/excel/math/priority1/radians1.xq - : @example test/Queries/excel/math/priority1/radians2.xq - : @example test/Queries/excel/math/priority1/radians3.xq - :) -declare function excel:radians($degree as xs:integer) as xs:decimal -{ - ($degree mod 360) div 180.0 * excel:pi() -}; - -(:~ - : Converts an arabic numeral to roman, as text. - : Only the clasic format is supported (out of all formats Excel requires).
- : M is the largest digit, it represents 1000. - : Numbers bigger than 2000 will be represented by a sequence of "M".
- : D = 500, C = 100, L = 50, X = 10, V = 5, I = 1. - : - : @see http://office.microsoft.com/en-us/excel/HP052092381033.aspx - : @param $number A positive integer. - : @return The roman string representation. - : @error excel-err:Num if the input integer is negative - : @example test/Queries/excel/math/priority1/roman1.xq - : @example test/Queries/excel/math/priority1/roman2.xq - : @example test/Queries/excel/math/priority1/roman3.xq - :) -declare function excel:roman($number as xs:integer) as xs:string -{ - if ($number lt 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Roman function: number should be greater than zero or equal") - else if ($number ge 1000) then - fn:concat("M", excel:roman($number - 1000)) - else if ($number ge 900) then - fn:concat("CM", excel:roman($number - 900)) - else if ($number ge 800) then - fn:concat("DCCC", excel:roman($number - 800)) - else if ($number ge 700) then - fn:concat("DCC", excel:roman($number - 700)) - else if ($number ge 600) then - fn:concat("DC", excel:roman($number - 600)) - else if ($number ge 500) then - fn:concat("D", excel:roman($number - 500)) - else if ($number ge 400) then - fn:concat("CD", excel:roman($number - 400)) - else if ($number ge 300) then - fn:concat("CCC", excel:roman($number - 300)) - else if ($number ge 200) then - fn:concat("CC", excel:roman($number - 200)) - else if ($number ge 100) then - fn:concat("C", excel:roman($number - 100)) - else if ($number ge 90) then - fn:concat("XC", excel:roman($number - 90)) - else if ($number ge 80) then - fn:concat("LXXX", excel:roman($number - 80)) - else if ($number ge 70) then - fn:concat("LXX", excel:roman($number - 70)) - else if ($number ge 60) then - fn:concat("LX", excel:roman($number - 60)) - else if ($number ge 50) then - fn:concat("L", excel:roman($number - 50)) - else if ($number ge 40) then - fn:concat("XL", excel:roman($number - 40)) - else if ($number ge 30) then - fn:concat("XXX", excel:roman($number - 30)) - else if ($number ge 20) then - fn:concat("XX", excel:roman($number - 20)) - else if ($number ge 10) then - fn:concat("X", excel:roman($number - 10)) - else if ($number eq 9) then - "IX" - else if ($number eq 8) then - "VIII" - else if ($number eq 7) then - "VII" - else if ($number eq 6) then - "VI" - else if ($number eq 5) then - "V" - else if ($number eq 4) then - "IV" - else if ($number eq 3) then - "III" - else if ($number eq 2) then - "II" - else if ($number eq 1) then - "I" - else - "" -}; diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/statistical-zorba.xq zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/statistical-zorba.xq --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/statistical-zorba.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/statistical-zorba.xq 1970-01-01 00:00:00.000000000 +0000 @@ -1,197 +0,0 @@ -xquery version "3.0"; - -(: - : Copyright 2006-2009 The FLWOR Foundation. - : - : Licensed under the Apache License, Version 2.0 (the "License"); - : you may not use this file except in compliance with the License. - : You may obtain a copy of the License at - : - : http://www.apache.org/licenses/LICENSE-2.0 - : - : Unless required by applicable law or agreed to in writing, software - : distributed under the License is distributed on an "AS IS" BASIS, - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - : See the License for the specific language governing permissions and - : limitations under the License. -:) - -(:~ - : This module implements some Excel 2003 statistical functions - : that cannot be implemented with standard XQuery functions. - : It uses Zorba specific functions. - : - : @Author Daniel Turcanu - : @See http://office.microsoft.com/en-us/excel/CH062528311033.aspx - : @project Zorba/Excel/Statistical Zorba -:) -module namespace excel = "http://www.zorba-xquery.com/modules/excel/statistical-zorba" ; - -import module namespace -excel-math="http://www.zorba-xquery.com/modules/excel/math"; - -import module namespace -excel-statistical="http://www.zorba-xquery.com/modules/excel/statistical"; - -declare namespace excel-err = "http://www.zorba-xquery.com/modules/excel/errors"; - -(:~ - : W3C Math namespace URI. -:) -declare namespace math="http://www.w3.org/2005/xpath-functions/math"; - -declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; -declare option ver:module-version "1.0"; - - -(:~ - : Estimates standard deviation based on a sample. - : The standard deviation is a measure of how widely values are dispersed - : from the average value (the mean). - : It is computed with formula: - : sqrt( sum((x-average_x)^2) / (n-1) ) = sqrt ( VAR(numbers) ) - : - : @see http://office.microsoft.com/en-us/excel/HP052092771033.aspx - : @param $numbers the sequence of numbers or values castable to numeric - : The sequence can be of any length, from 1 up. - : @return the standard deviation, as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/stdev1.xq -:) -declare function excel:stdev($numbers as xs:anyAtomicType+) as xs:anyAtomicType -{ - math:sqrt(excel-statistical:var($numbers)) -}; - -(:~ - : Estimates standard deviation based on a sample. - : The standard deviation is a measure of how widely values are dispersed - : from the average value (the mean). - : It is computed with formula: - : sqrt( sum((x-average_x)^2) / (n-1) ) = sqrt ( VARA(numbers) ) - : - : @see http://office.microsoft.com/en-us/excel/HP052092791033.aspx - : @param $numbers the sequence of numbers or values castable to numeric - : The sequence can be of any length, from 1 up. - : @return the standard deviation, as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/stdeva1.xq -:) -declare function excel:stdeva($numbers as xs:anyAtomicType+) as xs:anyAtomicType -{ - math:sqrt(excel-statistical:vara($numbers)) -}; - -(:~ - : Calculates standard deviation based on the entire population given as arguments. - : The standard deviation is a measure of how widely values are dispersed from - : the average value (the mean). - : It is computed with formula: - : sqrt( sum((x-average_x)^2) / n ) = sqrt ( VARP(numbers) ) - : - : @see http://office.microsoft.com/en-us/excel/HP052092811033.aspx - : @param $numbers the sequence of numbers or values castable to numeric - : The sequence can be of any length, from 1 up. - : @return the standard deviation, as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/stdevp1.xq -:) -declare function excel:stdevp($numbers as xs:anyAtomicType+) as xs:anyAtomicType -{ - math:sqrt(excel-statistical:varp($numbers)) -}; - -(:~ - : Calculates standard deviation based on the entire population given as arguments. - : The standard deviation is a measure of how widely values are dispersed from - : the average value (the mean). - : It is computed with formula: - : sqrt( sum((x-average_x)^2) / n ) = sqrt ( VARPA(numbers) ) - : - : @see http://office.microsoft.com/en-us/excel/HP052092831033.aspx - : @param $numbers the sequence of numbers or values castable to numeric - : The sequence can be of any length, from 1 up. - : @return the standard deviation, as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/stdevpa1.xq -:) -declare function excel:stdevpa($numbers as xs:anyAtomicType+) as xs:anyAtomicType -{ - math:sqrt(excel-statistical:varpa($numbers)) -}; - -(:~ - : Moved from math module. - : Returns a subtotal in a sequence of numbers. - : The function applied is given by $function_num. - : - : @see http://office.microsoft.com/en-us/excel/HP052092881033.aspx - : @param $function_num
defines the function to be applied on sequence values. - : The possible values are: - :
1 or 101
AVERAGE
- :
2 or 102
COUNT
- :
3 or 103
COUNTA
- :
4 or 104
MAX
- :
5 or 105
MIN
- :
6 or 106
PRODUCT
- :
7 or 107
STDEV
- :
8 or 108
STDEVP
- :
9 or 109
SUM
- :
10 or 110
VAR
- :
11 or 111
VARP
- : - : In this implementation there is no difference between x and 10x.
- : @param $numbers the sequence of numbers or values castable to numeric. - : The sequence can be of any length. - : @return The function result, as numeric type - : @error depends on the function called - : @error excel-err:Num if $function_num is not a value between 1 .. 11 or 101 .. 111 - : @example test/Queries/excel/statistical/priority1/subtotal1.xq - : @example test/Queries/excel/statistical/priority1/subtotal2.xq - : @example test/Queries/excel/statistical/priority1/subtotal3.xq - : @example test/Queries/excel/statistical/priority1/subtotal4.xq - : @example test/Queries/excel/statistical/priority1/subtotal5.xq - : @example test/Queries/excel/statistical/priority1/subtotal6.xq - : @example test/Queries/excel/statistical/priority1/subtotal7.xq - : @example test/Queries/excel/statistical/priority1/subtotal8.xq - : @example test/Queries/excel/statistical/priority1/subtotal9.xq - : @example test/Queries/excel/statistical/priority1/subtotal10.xq - : @example test/Queries/excel/statistical/priority1/subtotal11.xq -:) -declare function excel:subtotal($function_num as xs:integer, $numbers as xs:anyAtomicType*) as xs:anyAtomicType -{ - if ($function_num = 1 or $function_num = 101) then - excel-statistical:average($numbers) - else - if ($function_num = 2 or $function_num = 102) then - excel-statistical:count($numbers) - else - if ($function_num = 3 or $function_num = 103) then - excel-statistical:counta($numbers) - else - if ($function_num = 4 or $function_num = 104) then - excel-statistical:max($numbers) - else - if ($function_num = 5 or $function_num = 105) then - excel-statistical:min($numbers) - else - if ($function_num = 6 or $function_num = 106) then - excel-math:product($numbers) - else - if ($function_num = 7 or $function_num = 107) then - excel:stdev($numbers) - else - if ($function_num = 8 or $function_num = 108) then - excel:stdevp($numbers) - else - if ($function_num = 9 or $function_num = 109) then - excel-math:sum($numbers) - else - if ($function_num = 10 or $function_num = 110) then - excel-statistical:var($numbers) - else - if ($function_num = 11 or $function_num = 111) then - excel-statistical:varp($numbers) - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Subtotal function: function_num should be between 1 and 11 or 101 and 111") -}; diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/statistical.xq zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/statistical.xq --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/statistical.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/statistical.xq 1970-01-01 00:00:00.000000000 +0000 @@ -1,922 +0,0 @@ -xquery version "3.0"; - -(: - : Copyright 2006-2009 The FLWOR Foundation. - : - : Licensed under the Apache License, Version 2.0 (the "License"); - : you may not use this file except in compliance with the License. - : You may obtain a copy of the License at - : - : http://www.apache.org/licenses/LICENSE-2.0 - : - : Unless required by applicable law or agreed to in writing, software - : distributed under the License is distributed on an "AS IS" BASIS, - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - : See the License for the specific language governing permissions and - : limitations under the License. - :) - -(:~ - : This is a library module offering a part of the set of statistical functions - : defined by Microsoft Excel 2003. - : - : @see Excel 2003 Documentation: Statistical Functions - : - : @author Daniel Turcanu - : @project Zorba/Excel/Statistical - : - :) -module namespace excel = "http://www.zorba-xquery.com/modules/excel/statistical" ; - -(:~ - : Import excel-math module functions. - :) -import module namespace excel-math="http://www.zorba-xquery.com/modules/excel/math"; - -declare namespace excel-err = "http://www.zorba-xquery.com/modules/excel/errors"; - -declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; -declare option ver:module-version "1.0"; - -(:~ - : Function for average function. - : This function should not be used outside this module. - : It counts all non-empty arguments from the sequence. - : The string value of every argument is used for checking. - : - : @param $numbers The sequence of values. - : @return The count of non-empty string values. - :) -declare %private function excel:count-non-empty($numbers as xs:anyAtomicType*) as xs:integer -{ - if (fn:empty($numbers)) then - 0 - else if (fn:string($numbers[1]) = "") then - excel:count-non-empty(fn:subsequence($numbers, 2)) - else - excel:count-non-empty(fn:subsequence($numbers, 2)) + 1 -}; - -(:~ - : Returns the average (arithmetic mean) of the arguments. - : Arguments can be empty values, otherwise must be castable to numeric. - : If sequence is empty then zero is returned. - : The sequence can be of any length. - : - : @see http://office.microsoft.com/en-us/excel/HP052089941033.aspx - : @param $numbers The sequence of numbers or empty values. - : @return The sum of all numbers divided by the number of non-empty values. - : @error excel-err:Value if the parameters cannot be casted to numeric type. - : @example test/Queries/excel/statistical/average1.xq - : @example test/Queries/excel/statistical/average2.xq - : @example test/Queries/excel/statistical/average3.xq - :) -declare function excel:average($numbers as xs:anyAtomicType*) as xs:anyAtomicType -{ - let $count := excel:count-non-empty($numbers) - return - if ($count gt 0) then - excel-math:sum((for $n in $numbers where fn:string($n) != "" return $n)) div $count - else - 0 -}; - -(:~ - : Counts the number of cells that contain numbers or values castable to numeric. - : - : @see http://office.microsoft.com/en-us/excel/HP052090261033.aspx - : @param $numbers The sequence of values, of any length. - : @return The count of numbers. - : @example test/Queries/excel/statistical/count1.xq - :) -declare function excel:count( $numbers as xs:anyAtomicType* ) as xs:integer -{ - if (fn:empty($numbers)) then - 0 - else - if (excel-math:is-a-number($numbers[1])) then - excel:count(fn:subsequence($numbers, 2)) + 1 - else - excel:count(fn:subsequence($numbers, 2)) -}; - -(:~ - : Counts the empty values in a sequence. - : The empty values are the ones with string value "". - : The value 0 is not counted. - : - : @see http://office.microsoft.com/en-us/excel/HP052090281033.aspx - : @param $cells the sequence of values, of any length - : @return The count - : @example test/Queries/excel/statistical/countblank1.xq -:) -declare function excel:countblank( $cells as xs:anyAtomicType* ) as xs:integer -{ - if (fn:empty($cells)) then - 0 - else - if (fn:string($cells[1]) = "") then - excel:countblank(fn:subsequence($cells, 2)) + 1 - else - excel:countblank(fn:subsequence($cells, 2)) -}; - -(:~ - : Returns the largest number in a sequence. - : - : @see http://office.microsoft.com/en-us/excel/HP052091701033.aspx - : @param $numbers the sequence of numbers or values castable to numeric. - : The sequence can be of any length. - : @return The max - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/max1.xq - : @example test/Queries/excel/statistical/max2.xq - : @example test/Queries/excel/statistical/max3.xq -:) -declare function excel:max ( $numbers as xs:anyAtomicType* ) as xs:anyAtomicType -{ - fn:max( - (for $n_at in $numbers - let $n := excel-math:cast-as-numeric($n_at) - return $n - ) - ) -}; - -(:~ - : Returns the smallest number in a sequence. - : - : @see http://office.microsoft.com/en-us/excel/HP052091761033.aspx - : @param $numbers the sequence of numbers or values castable to numeric. - : The sequence can be of any length. - : @return The min - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/min1.xq - : @example test/Queries/excel/statistical/min2.xq -:) -declare function excel:min ( $numbers as xs:anyAtomicType* ) as xs:anyAtomicType -{ - fn:min( - (for $n_at in $numbers - let $n := excel-math:cast-as-numeric($n_at) - return $n - ) - ) -}; - -(:~ - : Returns the median of the given numbers. - : The median is the number in the middle of a set of numbers. - : Half the numbers have values that are greater than the median, - : and half the numbers have values that are less than the median. - : - : - : @see http://office.microsoft.com/en-us/excel/HP052091741033.aspx - : @param $numbers the sequence of numbers, of any length - : @return for odd count of numbers return the number in the middle of the sorted sequence. - : For even count of numbers return the average of the two numbers in the middle. - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/median1.xq - : @example test/Queries/excel/statistical/median2.xq -:) -declare function excel:median( $numbers as xs:anyAtomicType* ) as xs:anyAtomicType -{ - let $number_count := excel:count( $numbers ) - let $sorted_numbers := excel-math:sort-numbers( $numbers ) return - if ($number_count mod 2 != 0) then - $sorted_numbers[$number_count idiv 2 + 1] - else - if ($number_count = 0) then - 0 - else - ($sorted_numbers[$number_count idiv 2] + $sorted_numbers[$number_count idiv 2 + 1] ) div 2 -}; - -(:~ - : Returns the most frequently occurring, or repetitive, value in a sequence. - : Arguments must be castable to numeric. - : - : @see http://office.microsoft.com/en-us/excel/HP052091831033.aspx - : @param $numbers the sequence of numbers, of any length - : @return The most occuring number - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @error fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA") if there are no duplicate numbers - : @example test/Queries/excel/statistical/mode1.xq - : @example test/Queries/excel/statistical/mode2.xq - : @example test/Queries/excel/statistical/mode3.xq -:) -declare function excel:mode( $numbers as xs:anyAtomicType* ) as xs:anyAtomicType -{ - if ( fn:empty($numbers)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Mode function: empty sequence") - else - let $result := - ( for $n_at in fn:distinct-values($numbers) - let $n := excel-math:cast-as-numeric($n_at) - let $count := fn:count( (for $d in $numbers where fn:string($d) = fn:string($n) return $d) ) - where $count > 1 - order by $count descending - return $n - ) return - if (fn:empty($result)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Mode function: no duplicate elements") - else - $result[1] -}; - -(:~ - : Returns the k-th percentile of values in a sequence. - : If k is not a multiple of 1/(n - 1), - : PERCENTILE interpolates to determine the value at the k-th percentile. - : The function is computed by (max-min)*k + min - : - : @see http://office.microsoft.com/en-us/excel/HP052092111033.aspx - : @param $numbers the sequence of numbers, of any length - : @param $k_at the percentile, with value between 0 .. 1 inclusive - : @return The computed percentile - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @error excel-err:Num if percentile is not between 0 .. 1 - : @example test/Queries/excel/statistical/percentile1.xq - : @example test/Queries/excel/statistical/percentile2.xq - : @example test/Queries/excel/statistical/percentile3.xq -:) -declare function excel:percentile( $numbers as xs:anyAtomicType*, $k_at as xs:anyAtomicType) as xs:anyAtomicType -{ - let $k := excel-math:cast-as-numeric($k_at) return - if ($k < 0 or $k > 1) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Percentile function: k must be a value between 0 and 1 inclusive") - else - let $max := excel:max($numbers) - let $min := excel:min($numbers) return - ($max - $min) * $k + $min -}; - - - -(:~ - : Function for AVEDEV. - : This function should not be used outside this module. - : Computes formula sum(abs(x - average)) for every x in $numbers - : - : @param $numbers The sequence of numbers or values castable to numeric. - : Sequence can be of any length. - : @param $average The average of all numbers, computed with function AVERAGE. - : @return The result of the formula. - : @error excel-err:Value if the parameters cannot be casted to numeric type. - :) -declare %private function excel:sum-deviations( - $numbers as xs:anyAtomicType*, - $average as xs:anyAtomicType) as xs:anyAtomicType -{ - if (fn:empty($numbers)) then - 0 - else - fn:abs(excel-math:cast-as-numeric($numbers[1]) - $average) + excel:sum-deviations(fn:subsequence($numbers, 2), $average) -}; - -(:~ - : Returns the average of the absolute deviations of data points from their mean. - : The formula is sum(abs(x - average_x))/n, where n is the count of x in the sequence. - : - : @see http://office.microsoft.com/en-us/excel/HP052089931033.aspx - : @param $numbers the sequence of numbers or values castable to numeric. - : Sequence can be of any length from 1 up. - : @return The formula result - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/priority1/avedev1.xq -:) -declare function excel:avedev($numbers as xs:anyAtomicType+) as xs:anyAtomicType -{ - let $average := excel:average($numbers) return - excel:sum-deviations($numbers, $average) div excel:count($numbers) -}; - -(:~ - : Function for AVERAGEA. - : This function should not be used outside this module. - : This function adds all values that are castable to numeric. - : - : @param $numbers A sequence of any values, any length. - : @return The sum of numbers. - :) -declare %private function excel:add-all-cells($numbers as xs:anyAtomicType*) as xs:anyAtomicType -{ - if (fn:empty($numbers)) then - 0 - else if (excel-math:is-a-number($numbers[1])) then - excel-math:cast-as-numeric($numbers[1]) + excel:add-all-cells(fn:subsequence($numbers, 2)) - else (: if (fn:string($numbers[1]) = "") then :) - excel:add-all-cells(fn:subsequence($numbers, 2)) -(: else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value is not a number or empty cell ", $numbers[1]) -:) -}; - -(:~ - : Calculates the average (arithmetic mean) of the values in the sequence of arguments. - : Arguments can be of any type. - : The numbers are added, and the sum is divided by the size of entire sequence. - : - : @see http://office.microsoft.com/en-us/excel/HP052089951033.aspx - : @param $numbers the sequence of values of any type. - : The sequence can be of any length, from 1 up. - : @return The result - : @example test/Queries/excel/statistical/priority1/averagea1.xq -:) -declare function excel:averagea($numbers as xs:anyAtomicType+) as xs:anyAtomicType -{ - excel:add-all-cells($numbers) div fn:count($numbers) -}; - -(:~ - : Counts the number of values that are not empty. - : Empty values are the one with string value "". - : - : @see http://office.microsoft.com/en-us/excel/HP052090271033.aspx - : @param $numbers the sequence of values of any type, any length - : @return The count of non-empty values - : @example test/Queries/excel/statistical/priority1/counta1.xq -:) -declare function excel:counta($numbers as xs:anyAtomicType*) as xs:integer -{ - if (fn:empty($numbers)) then - 0 - else - if (fn:string($numbers[1]) != "") then - 1 + excel:counta(fn:subsequence($numbers, 2)) - else - excel:counta(fn:subsequence($numbers, 2)) -}; - -(:~ - : Returns the k-th largest value in a data set. - : If n is the number of data points in a range, - : then LARGE(array,1) returns the largest value, - : and LARGE(array,n) returns the smallest value. - : - : @see http://office.microsoft.com/en-us/excel/HP052091511033.aspx - : @param $numbers the sequence of numbers or values castable to numeric. - : The sequence can be of any length, from 1 up. - : @param $k the position of largest value, with value from 1 to count of values - : @return The k-th largest value as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @error excel-err:Num if the sequence is empty - : @error excel-err:Num if k is not a value between 1 and the sequence size - : @example test/Queries/excel/statistical/priority1/large1.xq - : @example test/Queries/excel/statistical/priority1/large2.xq - : @example test/Queries/excel/statistical/priority1/large3.xq -:) -declare function excel:large($numbers as xs:anyAtomicType*, $k as xs:integer) as xs:anyAtomicType -{ - if (fn:empty($numbers)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Large function: value list must not be empty") - else if ($k > fn:count($numbers) or $k le 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Large function: k must be between 1 and the count of numbers ", $k) - else - let $ordered_numbers := - (for $n in $numbers - let $nn := excel-math:cast-as-numeric($n) - order by $nn descending - return $nn - ) return - $ordered_numbers[$k] -}; - -(:~ - : Returns the largest value in a list of arguments. - : In this implementation there is no difference between MAX and MAXA. - : - : @see http://office.microsoft.com/en-us/excel/HP052091711033.aspx - : @param $numbers the sequence of numbers or values castable to numeric - : The sequence can be of any length. - : @return The max - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/priority1/maxa1.xq -:) -declare function excel:maxa($numbers as xs:anyAtomicType*) as xs:anyAtomicType -{ - excel:max($numbers) -}; - -(:~ - : Returns the smallest value in a list of arguments. - : In this implementation there is no difference between MAX and MAXA. - : - : @see http://office.microsoft.com/en-us/excel/HP052091771033.aspx - : @param $numbers the sequence of numbers or values castable to numeric - : The sequence can be of any length. - : @return The min - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/priority1/mina1.xq -:) -declare function excel:mina($numbers as xs:anyAtomicType*) as xs:anyAtomicType -{ - excel:min($numbers) -}; - -(:~ - : Returns the rank of a number in a list of numbers. - : The rank of a number is its size relative to other values in a list. - : (If you were to sort the list, the rank of the number would be its position.) - : RANK gives duplicate numbers the same rank. - : - : @see http://office.microsoft.com/en-us/excel/HP052092311033.aspx - : @param $x The number whose rank you want to find. - : @param $numbers The sequence of numbers or values castable to numbers. - : The sequence can be of any length. - : @param $order_ascending
A boolean having the meaning: - :
false
then rank the number as if the sequence was sorted in descending order.
- :
true
then rank the number as if the sequence was sorted in ascending order.
- : @return The rank of $x. - : @error excel-err:Value if the parameters cannot be casted to numeric type. - : @example test/Queries/excel/statistical/priority1/rank1.xq - : @example test/Queries/excel/statistical/priority1/rank2.xq - : @example test/Queries/excel/statistical/priority1/rank4.xq - :) -declare function excel:rank( - $x as xs:anyAtomicType, - $numbers as xs:anyAtomicType*, - $order_ascending as xs:boolean) as xs:decimal -{ - let $ordered_numbers := - if ($order_ascending) then ( - for $n in $numbers - let $nn := excel-math:cast-as-numeric($n) - order by $nn ascending - return $nn - ) else ( - for $n in $numbers - let $nn := excel-math:cast-as-numeric($n) - order by $nn descending - return $nn - ) - let $xnum := excel-math:cast-as-numeric($x) - let $rank := - ( - for $i at $pos in $ordered_numbers - where $xnum = $i or $order_ascending and $xnum < $i - or fn:not($order_ascending) and $xnum > $i - return - if ($xnum = $i) then - $pos - else if ($pos = 1) then - 0 - else - ($pos - 1) + ($xnum - $ordered_numbers[$pos - 1]) div ($ordered_numbers[$pos] - $ordered_numbers[$pos - 1]) - ) - return - if (fn:empty($rank)) then - fn:count($numbers) - else - $rank[1] -}; - -(:~ - : This RANK function is same as the above, only that $order_ascending is set by default to false. - : - : @see http://office.microsoft.com/en-us/excel/HP052092311033.aspx - : @param $x The number whose rank you want to find. - : @param $numbers the sequence of numbers or values castable to numbers. - : The sequence can be of any length. - : @return The rank of $x. - : @error excel-err:Value if the parameters cannot be casted to numeric type. - : @example test/Queries/excel/statistical/priority1/rank3.xq - : @example test/Queries/excel/statistical/priority1/rank5.xq -:) -declare function excel:rank( - $x as xs:anyAtomicType, - $numbers as xs:anyAtomicType*) as xs:decimal -{ - excel:rank($x, $numbers, fn:false()) -}; - -(:~ - : Returns the rank of a value in a data set as a percentage of the data set. - : If x does not match one of the values in array, - : PERCENTRANK interpolates to return the correct percentage rank.
- : The formula is uses: (RANK - 1) / (size - 1) . - : - : @see http://office.microsoft.com/en-us/excel/HP052092121033.aspx - : @param $numbers the sequence of numbers or values castable to numbers. - : The sequence can be of any length, from 1 up. - : @param $x is the value for which you want to know the rank - : @return The percentage of rank. - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @error excel-err:Num if the sequence is zero length - : @example test/Queries/excel/statistical/priority1/percentrank1.xq - : @example test/Queries/excel/statistical/priority1/percentrank2.xq - : @example test/Queries/excel/statistical/priority1/percentrank3.xq - : @example test/Queries/excel/statistical/priority1/percentrank4.xq - : @example test/Queries/excel/statistical/priority1/percentrank5.xq -:) -declare function excel:percentrank($numbers as xs:anyAtomicType*, $x as xs:anyAtomicType) as xs:decimal -{ - if (fn:empty($numbers)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Percentrank function: value list must not be empty") - else - let $rank := excel:rank($x, $numbers, fn:true()) return - if ($rank = 0) then - 0 - else - ($rank - 1) div (fn:count($numbers) - 1) -}; - -(:~ - : Returns the quartile of a data set. - : - : @see http://office.microsoft.com/en-us/excel/HP052092261033.aspx - : @param $numbers sequence of numbers or values castable to numbers. - : The sequence can be of any length, from 1 up. - : @param $quart
one of the values 0, 1, 2, 3, 4 with meaning: - :
0
compute minimum value
- :
1
compute first quartile (25th percentile)
- :
2
compute median value (50th percentile)
- :
3
compute third quartile (75th percentile)
- :
4
compute maximum value
- : @return the computed quartile, as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @error excel-err:Num if the sequence is zero length - : @error excel-err:Num if $quart is not one of the values 0, 1, 2, 3, 4 - : @example test/Queries/excel/statistical/priority1/quartile1.xq - : @example test/Queries/excel/statistical/priority1/quartile2.xq - : @example test/Queries/excel/statistical/priority1/quartile3.xq - : @example test/Queries/excel/statistical/priority1/quartile4.xq - : @example test/Queries/excel/statistical/priority1/quartile5.xq -:) -declare function excel:quartile($numbers as xs:anyAtomicType*, $quart as xs:integer) as xs:anyAtomicType -{ - if (fn:empty($numbers)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Quartile function: value list must not be empty") - else - if ($quart = 0) then - excel:min($numbers) - else - if ($quart = 1) then - let $r := (fn:count($numbers) + 3) div 4 - let $rint := xs:integer($r) - let $rrem := $r - $rint - let $sorted_numbers := excel-math:sort-numbers( $numbers ) return - ($numbers[$rint + 1] - $numbers[$rint]) * $rrem + $numbers[$rint] - else - if ($quart = 2) then - excel:median($numbers) - else - if ($quart = 3) then - let $r := (3 * fn:count($numbers) + 1) div 4 - let $rint := xs:integer($r) - let $rrem := $r - $rint - let $sorted_numbers := excel-math:sort-numbers( $numbers ) return - ($numbers[$rint + 1] - $numbers[$rint]) * $rrem + $numbers[$rint] - else - if ($quart = 4) then - excel:max($numbers) - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Quartile function: quart should be between 0 and 4 :", $quart) -}; - -(:~ - : This function computes the k-th smallest value in a data set. - : Use this function to return values with a particular relative standing in a data set. - : If n is the number of data points in array, SMALL(array,1) equals the smallest value, - : and SMALL(array,n) equals the largest value. - : - : @see http://office.microsoft.com/en-us/excel/HP052092661033.aspx - : @param $numbers A sequence of numbers or values castable to numeric. - : The sequence can be of any length, from 1 up. - : @param $k The position (from the smallest) in the sequence of data to return. - : Must have value between 1 and size of sequence. - : @return The k-th smallest value of $numbers. - : @error excel-err:Value if the parameters cannot be casted to numeric type. - : @error excel-err:Num if the sequence is zero length. - : @error excel-err:Num if $k is not a value between 1 and the size of sequence. - : @example test/Queries/excel/statistical/priority1/small1.xq - : @example test/Queries/excel/statistical/priority1/small2.xq -:) -declare function excel:small($numbers as xs:anyAtomicType*, $k as xs:integer) as xs:anyAtomicType -{ - if (fn:empty($numbers)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Small function: value list must not be empty") - else if ($k gt fn:count($numbers) or $k le 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Small function: k must be between 1 and the count of numbers ", $k) - else - let $ordered_numbers := ( - for $n in $numbers - let $nn := excel-math:cast-as-numeric($n) - order by $nn ascending - return $nn - ) - return - $ordered_numbers[$k] -}; - - -(:~ - : Function for VAR, VARA, VARP, VARPA and SLOPE. - : This function should not be used outside this module. - : It computes formula sum((x - average_x)^2) for all x in $numbers. - : - : @param $numbers the sequence of numbers or values castable to numbers. - : The sequence can be of any length. - : @param $average The precomputed average over the sequence. - : @return The result as numeric type. - : @error excel-err:Value if the parameters cannot be casted to numeric type. - :) -declare %private function excel:sumsq-deviations($numbers as xs:anyAtomicType*, $average as xs:anyAtomicType) as xs:anyAtomicType -{ - if (fn:empty($numbers)) then - 0 - else - let $val := excel-math:cast-as-numeric($numbers[1]) - $average - return - $val * $val + excel:sumsq-deviations(fn:subsequence($numbers, 2), $average) -}; - -(:~ - : Estimates variance based on a sample.
- : The formula is sum(x - average_x)^2 / (n - 1).
- : average_x is computed with AVERAGE function.
- : n is the count of numbers from the sequence, excluding empty values. - : - : @see http://office.microsoft.com/en-us/excel/HP052093301033.aspx - : @param $numbers the sequence of numbers or values castable to numeric. - : The sequence can be of any length, from 1 up. - : @return The variance, as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/priority1/var1.xq - :) -declare function excel:var($numbers as xs:anyAtomicType+) as xs:anyAtomicType -{ - let $average := excel:average($numbers) - return - excel:sumsq-deviations($numbers, $average) div (excel:count($numbers) - 1) -}; - -(:~ - : Estimates variance based on a sample.
- : The formula is sum(x - average_x)^2 / (n - 1).
- : average_x is computed with AVERAGE function.
- : n is the size of sequence, including empty values.
- : - : @see http://office.microsoft.com/en-us/excel/HP052093311033.aspx - : @param $numbers the sequence of numbers or values castable to numeric. - : The sequence can be of any length, from 1 up. - : @return The variance, as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/priority1/vara1.xq -:) -declare function excel:vara($numbers as xs:anyAtomicType+) as xs:anyAtomicType -{ - let $average := excel:average($numbers) return - excel:sumsq-deviations($numbers, $average) div (fn:count($numbers) - 1) -}; - -(:~ - : Calculates variance based on the entire population.
- : The formula is sum(x - average_x)^2 / n.
- : average_x is computed with AVERAGE function.
- : n is the count of numbers from the sequence, excluding empty values.
- : - : @see http://office.microsoft.com/en-us/excel/HP052093321033.aspx - : @param $numbers the sequence of numbers or values castable to numeric. - : The sequence can be of any length, from 1 up. - : @return The variance, as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/priority1/varp1.xq -:) -declare function excel:varp($numbers as xs:anyAtomicType+) as xs:anyAtomicType -{ - let $average := excel:average($numbers) return - excel:sumsq-deviations($numbers, $average) div excel:count($numbers) -}; - -(:~ - : Calculates variance based on the entire population.
- : The formula is sum(x - average_x)^2 / n.
- : average_x is computed with AVERAGE function.
- : n is the size of sequence, including empty values.
- : - : @see http://office.microsoft.com/en-us/excel/HP052093321033.aspx - : @param $numbers the sequence of numbers or values castable to numeric. - : The sequence can be of any length, from 1 up. - : @return The variance, as numeric type - : @error excel-err:Value if the parameters cannot be casted to numeric type - : @example test/Queries/excel/statistical/priority1/varpa1.xq -:) -declare function excel:varpa($numbers as xs:anyAtomicType+) as xs:anyAtomicType -{ - let $average := excel:average($numbers) return - excel:sumsq-deviations($numbers, $average) div fn:count($numbers) -}; - -(:~ - : Function for PROB function. - : This function should not be used outside this module. - : Computes the sum over a sequence of numbers. - : Checks if the values are between 0 and 1. - : - : @param $prob_range The sequence of probabilities. - : @return The sum of probabilities. This should be 1. - : @error excel-err:Num if any probability is not between 0 and 1. - : @error excel-err:Value if any parameter is not castable to numeric. -:) -declare %private function excel:sum-prob($prob_range as xs:anyAtomicType*) as xs:anyAtomicType -{ - if (fn:empty($prob_range)) then - 0 - else - let $prob_num := excel-math:cast-as-numeric($prob_range[1]) - return - if ($prob_num < 0 or $prob_num > 1) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Prob function: prob values should be between 0 and 1 ", $prob_num) - else - $prob_num + excel:sum-prob(fn:subsequence($prob_range, 2)) -}; - -(:~ - : Function for PROB function. - : This function should not be used outside this module. - : Checks the prob range and x range if they have the same number of values. - : Adds all probabilities corresponding to values between range_lower_limit and upper_limit. - : - : @param $x_range The sequence of x values. - : @param $prob_range The sequence of probabilies associated to x values. - : @param $range_lower_limit The lower limit of the range to compute the probability. - : @param $upper_limit The upper limit of the range to compute the probability. - : @return The sum of probabilities. - : @error excel-err:Value if any parameter is not castable to numeric. - : @error excel-err:Num if x_range and prob_range do not have the same number of values. - :) -declare %private function excel:sum-prob-x( - $x_range as xs:anyAtomicType*, - $prob_range as xs:anyAtomicType*, - $range_lower_limit as xs:anyAtomicType, - $upper_limit as xs:anyAtomicType) as xs:anyAtomicType -{ - if (fn:empty($x_range) and fn:not(fn:empty($prob_range))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Prob function: x range and prob range should have the same number of elements") - else if (fn:empty($prob_range) and fn:not(fn:empty($x_range))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Prob function: x range and prob range should have the same number of elements") - else if (fn:empty($prob_range) and fn:empty($x_range)) then - 0 - else - let $x := excel-math:cast-as-numeric($x_range[1]) - let $this_prob := - if ($x ge $range_lower_limit and $x le $upper_limit) then - excel-math:cast-as-numeric($prob_range[1]) - else - 0 - return - $this_prob + excel:sum-prob-x( - fn:subsequence($x_range, 2), - fn:subsequence($prob_range, 2), - $range_lower_limit, - $upper_limit) -}; - -(:~ - : Returns the probability that values in a range are between two limits. - : - : @see http://office.microsoft.com/en-us/excel/HP052092221033.aspx - : @param $x_range is the range of numeric values of x with which there are associated probabilities. - : This does not need to be ordered. - : @param $prob_range is a set of probabilities associated with values in x_range. - : @param $range_lower_limit is the lower bound on the value for which you want a probability. - : @param $upper_limit is the upper bound on the value for which you want a probability. - : @return The probability of the entire range - : @error excel-err:Num if any probability is not between 0 and 1 - : @error excel-err:Num if the sum of probabilities is not equal to 1 - : @error excel-err:Value if any parameter is not castable to numeric - : @error excel-err:Num if x_range and prob_range do not have the same number of values - : @example test/Queries/excel/statistical/priority2/prob2.xq -:) -declare function excel:prob($x_range as xs:anyAtomicType+, - $prob_range as xs:anyAtomicType+, - $range_lower_limit as xs:anyAtomicType, - $upper_limit as xs:anyAtomicType) as xs:anyAtomicType -{ - let $prob_sum := excel:sum-prob($prob_range) return - if ($prob_sum != 1) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Prob function: prob sum should equal 1") - else - excel:sum-prob-x($x_range, $prob_range, - excel-math:cast-as-numeric($range_lower_limit), - excel-math:cast-as-numeric($upper_limit)) -}; - -(:~ - : This is the same as above, only that upper_limit is not specified. - : The probability is computed only for range_lower_limit. - : - : @see http://office.microsoft.com/en-us/excel/HP052092221033.aspx - : @param $x_range is the range of numeric values of x with which there are associated probabilities. - : This does not need to be ordered. - : @param $prob_range is a set of probabilities associated with values in x_range. - : @param $range_lower_limit is the value for which you want a probability. - : @return The probability of the range_lower_limit value - : @error excel-err:Num if any probability is not between 0 and 1 - : @error excel-err:Num if the sum of probabilities is not equal to 1 - : @error excel-err:Value if any parameter is not castable to numeric - : @error excel-err:Num if x_range and prob_range do not have the same number of values - : @example test/Queries/excel/statistical/priority2/prob1.xq - :) -declare function excel:prob($x_range as xs:anyAtomicType+, - $prob_range as xs:anyAtomicType+, - $range_lower_limit as xs:anyAtomicType) as xs:anyAtomicType -{ - excel:prob($x_range, $prob_range, $range_lower_limit, $range_lower_limit) -}; - -(:~ - : Function for SLOPE function. - : This function should not be used outside this module. - : It computes the formula:
- : sum((x - average_x)(y - average_y))
- : where average_x and average_y are computed with AVERAGE function. - : - : @param $x_numbers The sequence of x numbers. - : @param $x_average The precomputed AVERAGE over the x_numbers. - : @param $y_numbers The sequence of y numbers. - : @param $y_average The precomputed AVERAGE over the y_numbers. - : @return The formula result, as numeric type. - : @error excel-err:Value if any parameter cannot be casted to numeric. - : @error fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA") if there are different numbers of x's and y's. - :) -declare %private function excel:sum-x-y-deviations( - $x_numbers as xs:anyAtomicType*, - $x_average as xs:anyAtomicType, - $y_numbers as xs:anyAtomicType*, - $y_average as xs:anyAtomicType) as xs:anyAtomicType -{ - if (fn:empty($x_numbers) and fn:not(fn:empty($y_numbers))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Slope function: different number of x's and y's") - else if (fn:empty($y_numbers) and fn:not(fn:empty($x_numbers))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Slope function: different number of x's and y's") - else if (fn:empty($x_numbers) and fn:empty($y_numbers)) then - 0 - else - (excel-math:cast-as-numeric($x_numbers[1]) - $x_average) * - (excel-math:cast-as-numeric($y_numbers[1]) - $y_average) + - excel:sum-x-y-deviations( - fn:subsequence($x_numbers, 2),$x_average, - fn:subsequence($y_numbers, 2),$y_average) -}; - -(:~ - : Returns the slope of the linear regression line through data points in known_y's and known_x's. - : The slope is the vertical distance divided by the horizontal distance between - : any two points on the line, which is the rate of change along the regression line. - : It computes the formula:
- : sum((x - average_x)(y - average_y)) / sum((x - average_x)^2)
- : where average_x and average_y are computed with AVERAGE function. - : - : @see http://office.microsoft.com/en-us/excel/HP052092641033.aspx - : @param $known_y the sequence of y numbers. - : The sequence can be of any length, from 1 up. - : @param $known_x the sequence of x numbers. - : The sequence can be of any length, from 1 up. - : @return The slope value, as numeric type - : @error excel-err:Value if any parameter cannot be casted to numeric - : @error fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA") if there are different numbers of x's and y's - : @error fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA") if any sequence is empty - : @error excel-err:Div0 if all x's are equal - : @example test/Queries/excel/statistical/priority2/slope1.xq -:) -declare function excel:slope($known_y as xs:anyAtomicType+, - $known_x as xs:anyAtomicType+) as xs:anyAtomicType -{ - if (fn:empty($known_y) or fn:empty($known_x)) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:NA"), "Slope function: known_x and known_y cannot be empty sequences") - else - let $x_average := excel:average($known_x) - let $y_average := excel:average($known_y) - let $xsq_dev := excel:sumsq-deviations($known_x, $x_average) return - if ($xsq_dev = 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Div0"), "Slope function: all x's are equal") - else - let $x_y_dev := excel:sum-x-y-deviations($known_x, $x_average, $known_y, $y_average) return - $x_y_dev div $xsq_dev -}; - -(:~ - : Returns a normalized value from a distribution characterized by mean and standard_dev.
- : The formula is (x - mean) / standard_dev . - : - : @see http://office.microsoft.com/en-us/excel/HP052092731033.aspx - : @param $x is the value you want to normalize - : @param $mean is the arithmetic mean of the distribution. - : @param $standard_dev is the standard deviation of the distribution. - : @return The normalized x, as numeric type - : @error excel-err:Value if any parameter cannot be casted to numeric - : @error excel-err:Num if standard_dev is a value smaller than zero or equal - : @example test/Queries/excel/statistical/priority2/standardize1.xq -:) -declare function excel:standardize($x as xs:anyAtomicType, - $mean as xs:anyAtomicType, - $standard_dev as xs:anyAtomicType) as xs:double -{ - if ($standard_dev le 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Num"), "Standardize function: standard_dev must be positive ", $standard_dev) - else - (excel-math:cast-as-numeric($x) - excel-math:cast-as-numeric($mean)) div excel-math:cast-as-numeric($standard_dev) -}; diff -Nru zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/text.xq zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/text.xq --- zorba-excel-module-2.9.1/src/com/zorba-xquery/www/modules/excel/text.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/src/com/zorba-xquery/www/modules/excel/text.xq 1970-01-01 00:00:00.000000000 +0000 @@ -1,767 +0,0 @@ -xquery version "3.0"; - -(: - : Copyright 2006-2009 The FLWOR Foundation. - : - : Licensed under the Apache License, Version 2.0 (the "License"); - : you may not use this file except in compliance with the License. - : You may obtain a copy of the License at - : - : http://www.apache.org/licenses/LICENSE-2.0 - : - : Unless required by applicable law or agreed to in writing, software - : distributed under the License is distributed on an "AS IS" BASIS, - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - : See the License for the specific language governing permissions and - : limitations under the License. -:) - -(:~ - : This is a library module offering the same set of functions - : defined by Microsoft Excel, under Text and Data Functions. - : - : @author Sorin Nasoi - : - : @see Excel Documentation: Text Functions - : - : @project Zorba/Excel/Text - :) -module namespace excel-text = "http://www.zorba-xquery.com/modules/excel/text" ; - -declare namespace excel-err = "http://www.zorba-xquery.com/modules/excel/errors"; - -(:~ - : Import excel-math module functions. - :) -import module namespace excel-math="http://www.zorba-xquery.com/modules/excel/math"; - -declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; -declare option ver:module-version "1.0"; - -(:~ - : Returns the union of the values in two sequences in an implementation-defined order. It removes duplicates. - : - : @param $arg1 the first sequence. - : @param $arg2 the second sequence. - : @return The union of the values in two sequences in an implementation-defined order. It removes duplicates. - :) -declare %private function excel-text:value-union - ( $arg1 as xs:anyAtomicType* , - $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { - - fn:distinct-values(($arg1, $arg2)) - } ; - -(:~ - : Returns the intersection of the values in two sequences in an implementation-defined order. It removes duplicates. - : - : @param $arg1 the first sequence. - : @param $arg2 the second sequence. - : @return The intersection of the values in two sequences in an implementation-defined order. It removes duplicates. - :) -declare %private function excel-text:value-intersect - ( $arg1 as xs:anyAtomicType* , - $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { - - fn:distinct-values($arg1[.=$arg2]) - } ; - -(:~ - : Returns the values in one sequence that do not appear in the second sequence in an implementation-defined order. - : - : @param $arg1 the first sequence. - : @param $arg2 the second sequence. - : @return The values in one sequence that do not appear in the second sequence in an implementation-defined order. - :) -declare function excel-text:value-except - ( $arg1 as xs:anyAtomicType* , - $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { - - fn:distinct-values($arg1[not(.=$arg2)]) - } ; - -(:~ - : Reverses the order of characters in a string. - : - : @param $arg the string. - : @return Reverses the order of characters in a string or zero-length string if the argument is the empty sequence. - :) -declare %private function excel-text:reverse-string - ( $arg as xs:string? ) as xs:string { - - fn:codepoints-to-string(fn:reverse(fn:string-to-codepoints($arg))) - } ; - -(:~ - : Returns $string appended with enough repetitions of $padChar to make its length $length. - : - : @param $string the string. - : @param $padChar the character used for padding. - : @param $length the desired length. - : @return $string appended with enough repetitions of $padChar to make its length $length.
- : The $string is trunctated if it's length is greater than $length. - :) -declare %private function excel-text:pad-string-to-length - ( $string as xs:string? , - $padChar as xs:string , - $length as xs:integer ) as xs:string { - - fn:substring(fn:string-join (($string, for $i in (1 to $length) return $padChar),'') - ,1,$length) - } ; - -(:~ - : Returns $toPad appended with enough repetitions of $padChar to make its length $length, the characters are added before the string. - : - : @param $toPad the value to be padded. - : @param $padChar the character used for padding. - : @param $length the desired length. - : @error excel-err:Value if the length of the $toPad is greater than the desired length. - : @return $toPad appended with enough repetitions of $padChar to make its length $length, the characters are added before the string. - :) -declare function excel-text:pad-integer-to-length - ( $toPad as xs:anyAtomicType?, - $padChar as xs:string , - $length as xs:integer) as xs:string { - - if ($length < fn:string-length(fn:string($toPad))) - then fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Number can not ne padded to the desired length", $length) - else - excel-text:reverse-string(excel-text:pad-string-to-length( - excel-text:reverse-string(fn:string($toPad)),fn:substring($padChar, 1, 1),$length)) -}; - -(:~ - : Returns an integer representing the first position of a substring that matches $pattern within $arg. - : - : @param $arg the string. - : @param $pattern the pattern to match. - : @return An integer representing the first position of a substring that matches $pattern within $arg.
- : If $arg does not match $pattern, the empty sequence is returned. - :) -declare %private function excel-text:index-of-match-first - ( $arg as xs:string? , - $pattern as xs:string ) as xs:integer? { - - if (fn:matches($arg,$pattern)) - then fn:string-length(tokenize($arg, $pattern)[1]) + 1 - else () - } ; - -(:~ - : Returns an integer representing the first position of a substring that matches $pattern using $flags within $arg. - : - : @param $arg the string. - : @param $pattern the pattern to match. - : @param $flags options for the interpretation of the regular expression. - : @return An integer representing the first position of a substring that matches $pattern using $flags within $arg.
- : If $arg does not match $pattern, the empty sequence is returned. - :) -declare %private function excel-text:index-of-match-first - ( $arg as xs:string? , - $pattern as xs:string, - $flags as xs:string ) as xs:integer? { - - if (matches($arg,$pattern,$flags)) - then fn:string-length(tokenize($arg, $pattern, $flags)[1]) + 1 - else () - } ; - -(:~ - : Returns an integer representing the $instance_num position of a substring that matches $pattern within $arg starting from $pos. - : - : @param $arg the string. - : @param $pattern the pattern to match. - : @param $pos the position to start the search. - : @param $instance_num the instance match number. - : @return An integer representing the $instance_num position of a substring that matches $pattern within $arg starting from $pos.
- : If $arg does not match $pattern, the empty sequence is returned. - :) -declare %private function excel-text:index-of-match - ( $arg as xs:string? , - $pattern as xs:string, - $pos as xs:integer, - $instance_num as xs:integer) as xs:integer? { - - if($instance_num eq 1) - then $pos + excel-text:index-of-match-first(fn:substring($arg,$pos),$pattern) - 1 - else - let $index := excel-text:index-of-match-first(fn:substring($arg,$pos),$pattern) - return if(fn:not(fn:exists($index))) - then () - else excel-text:index-of-match($arg, $pattern, $pos + $index, ($instance_num - 1)) - } ; - -(:~ - : Splits $text in groups of $length characters starting from right to left. - : - : @param $text the string. - : @param $length the length of the group. - : @return Splits $text in groups of $length characters starting from right to left. - :) -declare %private function excel-text:tokenize-length - ($text as xs:string, - $length as xs:decimal) as xs:string* { - - if(fn:string-length($text) <= $length) then - $text - else - let $groupsNo := fn:string-length($text) idiv $length - let $tmp := fn:string-length($text) mod $length - return - if ($tmp eq 0) then - for $i in (1 to $groupsNo) - return fn:substring($text, (1 + ($length*($i - 1))), $length) - else - for $i in (0 to $groupsNo) - return - if ($i eq 0) then - fn:substring($text, 1, $tmp) - else - fn:substring($text, $tmp + ($length*($i - 1)) + 1, $length) -}; - -(:~ - : Returns the given $text unchanged. - : - : @see http://office.microsoft.com/en-us/excel/HP052508361033.aspx - : @param $text the time - : @return The given $text unchanged. - :) -declare function excel-text:asc - ( $text as xs:string) as xs:string { - - $text - } ; - -(:~ - : Returns the character specified by a certain codepoint. - : - : @see http://office.microsoft.com/en-us/excel/HP052090091033.aspx - : @param $number the codepoint. - : @error excel-err:Value provided $number must be in range [1,255]. - : @return the character specified by a certain codepoint. -Zorba uses UTF-8 encoding so the actual codepoint range is between [1,1114111] - :) - declare function excel-text:char - ( $number as xs:integer) as xs:string { - - if( (1 <= $number) and ($number <= 255)) then - fn:codepoints-to-string($number) - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided number must be in range [1,255]", $number) - } ; - -(:~ - : Returns a codepoint for the first character in a text string. - : - : @see http://office.microsoft.com/en-us/excel/HP052090151033.aspx - : @param $arg the string. - : @error excel-err:Value Provided $arg was empty. - : @return A codepoint for the first character in a text string. - :) -declare function excel-text:code - ( $arg as xs:string) as xs:integer { - - if( fn:string-length($arg) > 0 ) then - fn:string-to-codepoints(fn:substring($arg, 1, 1)) - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided text was empty",$arg) - } ; - -(:~ - : Joins two text strings into one text string. - : - : @see http://office.microsoft.com/en-us/excel/HP052090151033.aspx - : @param $arg1 the first string. - : @param $arg2 the second string. - : @return Joins two text strings into one text string. - :) -declare function excel-text:concatenate - ( $arg1 as xs:anyAtomicType?, - $arg2 as xs:anyAtomicType?) as xs:string { - - fn:concat($arg1,$arg2) - }; - -(:~ - : Joins several text strings into one text string. - : - : @see http://office.microsoft.com/en-us/excel/HP052090151033.aspx - : @param $args a sequence of strings. - : @return Joins several text strings into one text string. - :) -declare function excel-text:concatenate - ( $args as xs:anyAtomicType*) as xs:string { - - fn:string-join((for $value in $args return xs:string($value)), "") - } ; - -(:~ - : Removes all nonprintable characters from text. - : - : @see http://office.microsoft.com/en-us/excel/HP052090141033.aspx - : @param $arg the string. - : @return Removes all nonprintable characters from text. The CLEAN function was designed. - : to remove the first 32 nonprinting characters in the 7-bit ASCII code (values 0 through 31) from text.
- : In the Unicode character set, there are additional nonprinting characters (values 127, 129, 141, 143, 144, and 157).
- : By itself, the CLEAN function does not remove these additional nonprinting characters. - :) -declare function excel-text:clean - ( $arg as xs:string? ) as xs:string? { - - fn:codepoints-to-string( for $codepoint in fn:string-to-codepoints($arg) - return if ($codepoint < 32) then () else $codepoint) - } ; - -(:~ - : Rounds a number to the specified number of decimals, formats the number in - : decimal format using a period and commas, and returns the result as text. - : - : @see http://office.microsoft.com/en-us/excel/HP052090931033.aspx - : @param $number is the number you want to round and convert to text. - : @param $decimals is the number of digits to the right of the decimal point. - : @return Rounds a number to the specified number of decimals, formats the number in - : decimal format using a period and commas, and returns the result as text. - :) -declare function excel-text:fixed - ( $number as xs:decimal, - $decimals as xs:decimal) as xs:string { - - excel-text:fixed($number,$decimals,fn:false()) -}; - -(:~ - : Rounds a number to the specified number of decimals, formats the number in - :decimal format using a period and commas, and returns the result as text. - : - : @see http://office.microsoft.com/en-us/excel/HP052090931033.aspx - : @param $number is the number you want to round and convert to text. - : @param $decimals is the number of digits to the right of the decimal point. - : @param $no_commas is a logical value that, if TRUE, prevents FIXED from - :including commas in the returned text. - : @return Rounds a number to the specified number of decimals, formats the number in - :decimal format using a period and commas, and returns the result as text. - :) -declare function excel-text:fixed - ( $number as xs:decimal, - $decimals as xs:decimal, - $no_commas as xs:boolean) as xs:string { - - let $tmp := excel-math:round($number, $decimals) - - return if($no_commas) then - fn:string($tmp) - else - if(fn:contains(xs:string($tmp), '.')) then - let $x := fn:tokenize(xs:string($tmp),'[.]')[1] - let $y := fn:tokenize(xs:string($tmp),'[.]')[2] - let $x := fn:string-join(excel-text:tokenize-length($x,3), ',') - return fn:string-join(($x,$y),'.') - else - fn:string-join(excel-text:tokenize-length(fn:string($tmp),3), ',') - } ; - -(:~ - : Converts a number to text format and applies a currency symbol. The number of - :digits to the right of the decimal point is 2. - : - : @see http://office.microsoft.com/en-us/excel/HP052090931033.aspx - : @param $number is the number. - : @return Converts a number to text format and applies a currency symbol. The number of - :digits to the right of the decimal point is 2. - :) -declare function excel-text:dollar - ( $number as xs:decimal) as xs:string { - - excel-text:dollar($number, 2) - } ; - -(:~ - : Converts a number to text format and applies a currency symbol. - : - : @see http://office.microsoft.com/en-us/excel/HP052090931033.aspx - : @param $number is the number. - : @param $decimals is the number of digits to the right of the decimal point.
- :If decimals is negative, number is rounded to the left of the decimal point. - : @return Converts a number to text format and applies a currency symbol. - :) -declare function excel-text:dollar - ( $number as xs:decimal, - $decimals as xs:decimal) as xs:string { - - let $int := fn:tokenize(fn:concat("$", excel-text:fixed(excel-math:abs($number), $decimals)),'\.')[1] - let $decimal := fn:tokenize(fn:concat("$", excel-text:fixed(excel-math:abs($number), $decimals)),'\.')[2] - - return if( fn:empty($decimal) ) then $int - else fn:concat($int,'.',excel-text:pad-string-to-length($decimal,"0",$decimals)) - } ; - -(:~ - : Compares two text strings and returns TRUE if they are exactly the same, - :FALSE otherwise. EXACT is case-sensitive but ignores formatting differences. - : - : @see http://office.microsoft.com/en-us/excel/HP052090811033.aspx - : @param $arg1 the first string. - : @param $arg2 the second string. - : @return Compares two text strings and returns TRUE if they are exactly the same, - :FALSE otherwise. EXACT is case-sensitive but ignores formatting differences. - :) -declare function excel-text:exact - ($arg1 as xs:string, - $arg2 as xs:string) as xs:boolean { - - $arg1 eq $arg2 -}; - -(:~ - : Returns the first character in a text string. - : - : @see http://office.microsoft.com/en-us/excel/HP052091531033.aspx - : @param $arg is the text string that contains the characters you want to extract. - : @return The first character in a text string. - :) -declare function excel-text:left - ( $arg as xs:string) as xs:string { - excel-text:left($arg, 1) - }; - -(:~ - : Returns the first character or characters in $text, based on the number of $num_chars you specify. - : - : @see http://office.microsoft.com/en-us/excel/HP052091531033.aspx - : @param $text is the text string that contains the characters you want to extract. - : @param $num_chars specifies the number of characters you want to extract. - : @return The first character or characters in $text, based on the number of $num_chars you specify. - :) -declare function excel-text:left - ( $text as xs:string, - $num_chars as xs:integer) as xs:string { - - let $chars := if (fn:string-length($text) < $num_chars) then - fn:string-length($text) - else - $num_chars - - return fn:substring($text, 1, $chars) - } ; - -(:~ - : Returns the number of characters in a text string. - : - : @see http://office.microsoft.com/en-us/excel/HP052091541033.aspx - : @param $arg the string. - : @return The number of characters in a text string. - :) -declare function excel-text:len - ( $arg as xs:string?) as xs:integer { - - fn:string-length($arg) - } ; - -(:~ - : Converts all uppercase letters in a text string to lowercase. - : - : @see http://office.microsoft.com/en-us/excel/HP052091671033.aspx - : @param $arg the string. - : @return Converts all uppercase letters in a text string to lowercase. - :) -declare function excel-text:lower - ( $arg as xs:string?) as xs:string? { - - fn:lower-case($arg) - } ; - -(:~ - : Returns a specific number of characters from a text string, starting at - :the position you specify, based on the number of characters you specify. - : - : @see http://office.microsoft.com/en-us/excel/HP052091751033.aspx - : @param $text the text string containing the characters you want to extract. - : @param $start_num the position of the first character you want to extract - : in text. The first character in text has start_num 1, and so on. - : @param $num_chars the number of characters you want to return from text. - : @return A specific number of characters from a text string, starting at - : the position you specify, based on the number of characters you specify. - :) -declare function excel-text:mid - ( $text as xs:string?, - $start_num as xs:integer, - $num_chars as xs:integer) as xs:string? { - let $len := fn:string-length($text) - return - if ($start_num > $len) then - xs:string('') - else if ($start_num < 1) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value is less than 1", $start_num) - else if ($num_chars < 0) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value is less than zero", $num_chars) - else - fn:substring($text, $start_num, $num_chars) - }; - -(:~ - : Replaces part of a text string, based on the number of characters you specify, with a different text string. - : - : @see http://office.microsoft.com/en-us/excel/HP052092351033.aspx - : @param $old_text is text in which you want to replace some characters. - : @param $start_num the position of the character in old_text that you want to replace with new_text. - : @param $num_chars the number of characters in old_text that you want REPLACE to replace with new_text. - : @param $new_text the text that will replace characters in old_text. - : @return Replaces part of a text string, based on the number of characters you specify, with a different text string. - :) -declare function excel-text:replace - ( $old_text as xs:string?, - $start_num as xs:integer, - $num_chars as xs:integer, - $new_text as xs:string) as xs:string { - - fn:concat(fn:substring($old_text,0,$start_num), - $new_text, - fn:substring($old_text,$start_num + $num_chars)) - }; - -(:~ - : Returns the last character in a text string. - : - : @see http://office.microsoft.com/en-us/excel/HP052092371033.aspx - : @param $arg the text string containing the characters you want to extract. - : @return The last character in a text string. - :) -declare function excel-text:right - ( $arg as xs:string) as xs:string { - - excel-text:right($arg, 1) - } ; - -(:~ - : Returns the last character or characters in a text string, based on the number of characters you specify. - : - : @see http://office.microsoft.com/en-us/excel/HP052092371033.aspx - : @param $text the text string containing the characters you want to extract. - : @param $num_chars specifies the number of characters you want RIGHT to extract. - : @return The last character or characters in a text string, based on the number of characters you specify. - :) -declare function excel-text:right - ( $text as xs:string, - $num_chars as xs:integer) as xs:string { - - let $chars := if (fn:string-length($text) < $num_chars) then fn:string-length($text) else $num_chars - return fn:substring($text, (fn:string-length($text) - $chars + 1), $chars) - }; - -(:~ - : Locate one text string within a second text string, and return the number of - : the starting position of the first text string from the first character of the - : second text string.
The search starts at position 1, and it is not case sensitive. - : - : @see http://office.microsoft.com/en-us/excel/HP052092491033.aspx - : @param $find_text text you want to find. - : @param $within_text text in which you want to search for $find_text. - : @error excel-err:Value the value is not greater than zero or is greater than the length of within_text. - : @error excel-err:Value value was not found. - : @return Locate one text string within a second text string, and return the number of - : the starting position of the first text string from the first character of the - : second text string.
The search starts at position 1, and it is not case sensitive. - :) -declare function excel-text:search - ( $find_text as xs:string, - $within_text as xs:string) as xs:integer? { - - excel-text:search($find_text, $within_text, 1) -}; - -(:~ - : Locate one text string within a second text string, and return the number of - : the starting position of the first text string from the first character of the - : second text string.
The search starts at $start_num, and it is not case sensitive. - : - : @see http://office.microsoft.com/en-us/excel/HP052092491033.aspx - : @param $find_text text you want to find. - : @param $within_text text in which you want to search for $find_text. - : @param $start_num the character number in within_text at which you want to start searching. - : @error excel-err:Value the value is not greater than zero or is greater than the length of within_text. - : @error excel-err:Value value was not found. - : @return Locate one text string within a second text string, and return the number of - : the starting position of the first text string from the first character of the - : second text string.
The search starts at $start_num, and it is not case sensitive. - :) -declare function excel-text:search - ( $find_text as xs:string, - $within_text as xs:string, - $start_num as xs:integer) as xs:integer? { - - if(($start_num < 1) or ($start_num > fn:string-length($within_text))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "The value is not greater than zero or is greater than the length of within_text", $start_num) - else - let $source := fn:substring($within_text, $start_num) - - return if(fn:exists(excel-text:index-of-match-first($source, $find_text, "i"))) then - $start_num + excel-text:index-of-match-first($source, $find_text, "i") -1 - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Value was not found", $find_text) -}; - -(:~ - : Locate one text string within a second text string, and return the number of the - : starting position of the first text string from the first character of the second text string.
- : The search is case sensitive. - : - : @see http://office.microsoft.com/en-us/excel/HP052090891033.aspx - : @param $find_text text you want to find. - : @param $within_text text in which you want to search for $find_text. - : @error excel-err:Value the value is not greater than zero or is greater than the length of within_text. - : @error excel-err:Value value was not found. - : @return Locate one text string within a second text string, and return the number of the - : starting position of the first text string from the first character of the second text string.
- : The search is case sensitive. - :) -declare function excel-text:find - ( $find_text as xs:string, - $within_text as xs:string) as xs:integer? { - - excel-text:find($find_text, $within_text, 1) -}; - -(:~ - : Locate one text string within a second text string, and return the number of the - : starting position of the first text string from the first character of the second text string.
- : The search is case sensitive. - : - : @see http://office.microsoft.com/en-us/excel/HP052090891033.aspx - : @param $find_text text you want to find. - : @param $within_text text in which you want to search for $find_text. - : @param $start_num specifies the character at which to start the search. - : @error excel-err:Value the value is not greater than zero or is greater than the length of within_text. - : @error excel-err:Value value was not found. - : @return Locate one text string within a second text string, and return the number of the - : starting position of the first text string from the first character of the second text string.
- : The search is case sensitive. - :) -declare function excel-text:find - ( $find_text as xs:string, - $within_text as xs:string, - $start_num as xs:integer) as xs:integer? { - - if(($start_num < 1) or ($start_num > fn:string-length($within_text))) then - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "The value is not greater than zero or is greater than the length of within_text", $start_num) - else - let $source := fn:substring($within_text, $start_num) - - return if(fn:exists(excel-text:index-of-match-first($source, $find_text))) then - $start_num + excel-text:index-of-match-first($source, $find_text) -1 - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Value was not found", $find_text) -}; - -(:~ - : Substitutes new_text for old_text in a text string. - : - : @see http://office.microsoft.com/en-us/excel/HP052092861033.aspx - : @param $text the text or the reference to a cell containing text for which you want to substitute characters. - : @param $old_text text you want to replace. - : @param $new_text text you want to replace old_text with. - : @param $instance_num specifies which occurrence of old_text you want to replace with new_text.
- : Only that instance of old_text is replaced. - : @return Substitutes new_text for old_text in a text string.
Use SUBSTITUTE when you - : want to replace specific text in a text string; use REPLACE when you want - : to replace any text that occurs in a specific location in a text string. - :) -declare function excel-text:substitute - ( $text as xs:string, - $old_text as xs:string, - $new_text as xs:string, - $instance_num as xs:integer?) as xs:string { - - let $startPos := excel-text:index-of-match($text,$old_text,1,$instance_num) - return - if(fn:empty($startPos)) then $text - else excel-text:replace($text, $startPos, fn:string-length($old_text), $new_text) - } ; - -(:~ - : Substitutes new_text for old_text in a text string. Every occurrence of old_text in text is changed to new_text. - : - : @see http://office.microsoft.com/en-us/excel/HP052092861033.aspx - : @param $text the text or the reference to a cell containing text for which you want to substitute characters. - : @param $old_text text you want to replace. - : @param $new_text text you want to replace old_text with. - : @return Substitutes new_text for old_text in a text string. Every occurrence of old_text in text is changed to new_text. - :) -declare function excel-text:substitute - ( $text as xs:string, - $old_text as xs:string, - $new_text as xs:string) as xs:string? { - - fn:replace($text, $old_text, $new_text) - } ; - -(:~ - : Removes all spaces from text except for single spaces between words. - : - : @see http://office.microsoft.com/en-us/excel/HP052093211033.aspx?pid=CH062528321033 - : @param $text from which you want spaces removed. - : @return Removes all spaces from text except for single spaces between words. - :) -declare function excel-text:trim - ( $text as xs:string?) as xs:string? { - - fn:normalize-space($text) - } ; - -(:~ - : Converts text to uppercase. - : - : @see http://office.microsoft.com/en-us/excel/HP052093271033.aspx - : @param $text text you want converted to uppercase. - : @return Converts text to uppercase. - :) -declare function excel-text:upper - ( $text as xs:string?) as xs:string? { - - fn:upper-case($text) - }; - -(:~ - : Converts the $value to string. - : - : @see http://office.microsoft.com/en-us/excel/HP052093041033.aspx - : @param $value the value - : @return Converts the $value to string. - :) -declare function excel-text:t -( $value as xs:anyAtomicType?) as xs:string { - - if( $value instance of xs:string ) then fn:string($value) - else fn:string("") - } ; - -(:~ - : Converts a text string that represents a number to a number. - : - : @see http://office.microsoft.com/en-us/excel/HP052093291033.aspx - : @param $arg the value. - : @error excel-err:Value provided value is not a number. - : @return Converts a text string that represents a number to a number. - :) -declare function excel-text:value -( $arg as xs:anyAtomicType?) as xs:anyAtomicType? { - - typeswitch($arg) - case xs:double return $arg - case xs:decimal return $arg - case xs:double return $arg - case xs:float return $arg - default return - if($arg castable as xs:integer) then - xs:integer($arg) - else - if($arg castable as xs:decimal) then - xs:decimal($arg) - else - if($arg castable as xs:double) then - xs:double($arg) - else - fn:error(fn:QName("http://www.zorba-xquery.com/modules/excel/errors", "excel-err:Value"), "Provided value is not a number", $arg) -}; diff -Nru zorba-excel-module-2.9.1/src/datetime.xq zorba-excel-module-3.0.0/src/datetime.xq --- zorba-excel-module-2.9.1/src/datetime.xq 1970-01-01 00:00:00.000000000 +0000 +++ zorba-excel-module-3.0.0/src/datetime.xq 2013-11-07 17:11:01.000000000 +0000 @@ -0,0 +1,383 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2009 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. +:) + +(:~ + : This is a library module offering the same set of functions + : defined by Microsoft Excel. + : + : @see Excel Documentation: Datetime Functions + : + : @author Sorin Nasoi + : @project Zorba/Excel/Datetime + : + :) +module namespace excel-datetime = "http://zorba.io/modules/excel/datetime" ; + +declare namespace excel-err = "http://zorba.io/modules/excel/errors"; + +(:~ + : Import excel-text module functions. + :) +import module namespace excel-text = "http://zorba.io/modules/excel/text"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + +(:~ + : The day of the week, from a date. + : + : @param $date the date. + : @return the day of the week as a number, where from 0 (Sunday) to 6 (Saturday). + :) +declare %private function excel-datetime:day-of-week + ( $date as xs:anyAtomicType? ) as xs:integer? { + + if (fn:empty($date)) + then () + else xs:integer((xs:date($date) - xs:date('1899-01-01')) + div xs:dayTimeDuration('P1D')) mod 7 + } ; + +(:~ + : Tests if a year is leap or not. + : + : @param $date the date. + : @return true if the year part of the supplied $date is a leap year, false otherwise. + :) +declare %private function excel-datetime:is-leap-year + ( $date as xs:date ) as xs:boolean { + + let $year := fn:year-from-date($date) + return (($year mod 4 = 0 and $year mod 100 != 0) or + ($year mod 400 = 0)) + } ; + +(: actual requirements :) +(:~ + : Returns the number of days between two dates based on a 360-day year. + : + : @see http://office.microsoft.com/en-us/excel/HP052090471033.aspx + : @param $start_date the start date. + : @param $end_date the end date. + : @return The number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations.

+ : Use this function to help compute payments if your accounting system is based on twelve 30-day months.

+ : The metod used is U.S. (NASD). If the starting date is the last day of a month, it becomes equal to the 30th of the same month.

+ : If the ending date is the last day of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month; otherwise the ending date becomes equal to the 30th of the same month. + :) +declare function excel-datetime:days360 + ( $start_date as xs:date, + $end_date as xs:date) as xs:integer { + + excel-datetime:days360($start_date, $end_date, fn:false()) + } ; + +(:~ + : Returns the number of days between two dates based on a 360-day year. + : + : @see http://office.microsoft.com/en-us/excel/HP052090471033.aspx + : @param $start_date the start date. + : @param $end_date the end date. + : @param $method if false then US/NASD Method is used, otherwise the European Method is used. + : @return The number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations. + : Use this function to help compute payments if your accounting system is based on twelve 30-day months.

+ :The European Method (30E/360)

+ : - If either date A or B falls on the 31st of the month, that date will be changed to the 30th;

+ : - Where date B falls on the last day of February, the actual date B will be used.

+ : + :The US/NASD Method (30US/360)

+ : - If both date A and B fall on the last day of February, then date B will be changed to the 30th.

+ : - If date A falls on the 31st of a month or last day of February, then date A will be changed to the 30th.

+ : - If date A falls on the 30th of a month after applying (2) above and date B falls on the 31st of a month, then date B will be changed to the 30th. + :) +declare function excel-datetime:days360 + ( $start_date as xs:date, + $end_date as xs:date, + $method as xs:boolean) as xs:integer { + + if($method eq fn:true()) then (: European Method :) + let $sd := if (fn:day-from-date($start_date) eq 31) then + excel-datetime:date(fn:year-from-date($start_date), fn:month-from-date($start_date), 30) + else $start_date + + let $ed := if (fn:day-from-date($end_date) eq 31) then + excel-datetime:date(fn:year-from-date($end_date), fn:month-from-date($end_date), 30) + else $end_date + + let $ed1 := excel-datetime:date(fn:year-from-date($ed), fn:month-from-date($ed), 01) + + let $ret := fn:days-from-duration($ed1 - $sd)+ fn:day-from-date($ed) + return if($ret < 0) then $ret else $ret - 1 + else (: US/NASD Method :) + let $ed := if(($start_date = $end_date) and + ((excel-datetime:is-leap-year($end_date) and (fn:day-from-date($end_date) eq 29)) or + (fn:day-from-date($end_date) eq 28))) then + excel-datetime:date(fn:year-from-date($end_date), fn:month-from-date($end_date), 30) + else $end_date + + return if((fn:day-from-date($start_date) eq 31) or + ((excel-datetime:is-leap-year($start_date) and (fn:day-from-date($start_date) eq 29)) or + (fn:day-from-date($start_date) eq 28))) then + let $sd := excel-datetime:date(fn:year-from-date($start_date), fn:month-from-date($start_date), 30) + let $ed := if (fn:day-from-date($ed) eq 31) then + excel-datetime:date(fn:year-from-date($ed), fn:month-from-date($ed), 30) else + $ed + let $ed1 := excel-datetime:date(fn:year-from-date($ed), fn:month-from-date($ed), 01) + let $ret := fn:days-from-duration($ed1 - $sd)+ fn:day-from-date($ed) - 1 + return if($ret < 0) then $ret else $ret - 1 + else + let $ed1 := excel-datetime:date(fn:year-from-date($ed), fn:month-from-date($ed), 01) + let $ret := fn:days-from-duration($ed1 - $start_date)+ fn:day-from-date($ed) + return if($ret < 0) then $ret else $ret - 1 + } ; + +(:~ + : Returns the hour of a time value. + : + : @see http://office.microsoft.com/en-us/excel/HP052091151033.aspx + : @param $time the time. + : @return The hour of a time value. The hour is as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.). + :) +declare function excel-datetime:hour + ($time as xs:time) as xs:integer? { + + fn:hours-from-time($time) + }; + +(:~ + : Returns the minutes of a time value. + : + : @see http://office.microsoft.com/en-us/excel/HP052091781033.aspx + : @param $time the time. + : @return The minutes of a time value. The minute is given as an integer, ranging from 0 to 59. + :) +declare function excel-datetime:minute + ($time as xs:time) as xs:integer? { + + fn:minutes-from-time($time) + }; + +(:~ + : Returns the month of a $date. + : + : @see http://office.microsoft.com/en-us/excel/HP052091841033.aspx + : @param $date the date. + : @return the month of a $date. The month is given as an integer, ranging from 1 (January) to 12 (December). + :) +declare function excel-datetime:month + ($date as xs:date) as xs:integer? { + + fn:month-from-date($date) + }; + +(:~ + : Returns the seconds of a $time value. + : + : @see http://office.microsoft.com/en-us/excel/HP052092511033.aspx + : @param $time the time. + : @return The seconds of a $time value. The second is given as an integer in the range 0 (zero) to 59. + :) +declare function excel-datetime:second + ($time as xs:time) as xs:decimal ? { + + fn:seconds-from-time($time) + }; + +(:~ + : Returns the day of a $date, represented by a serial number. + : + : @see http://office.microsoft.com/en-us/excel/HP052090461033.aspx + : @param $date the date. + : @return The day of a $date, represented by a serial number. The day is given as an integer ranging from 1 to 31. + :) +declare function excel-datetime:day + ($date as xs:date) as xs:integer? { + + fn:day-from-date($date) + }; + +(:~ + : Returns the year corresponding to a date. + : + : @see http://office.microsoft.com/en-us/excel/HP052093431033.aspx + : @param $date the date. + : @return The year corresponding to a date. + :) +declare function excel-datetime:year + ($date as xs:date) as xs:integer? { + + fn:year-from-date($date) + }; + +(:~ + : Returns the current date. + : + : @see http://www.w3.org/TR/xquery-operators/#func-current-date + : @return The current date. + :) +declare function excel-datetime:today + () as xs:date? { + + fn:current-date() + }; + +(:~ + : Returns the current date and time. + : + : @see http://www.w3.org/TR/xquery-operators/#func-current-dateTime + : @return The current date and time. + :) +declare function excel-datetime:now + () as xs:dateTime? { + + fn:current-dateTime() + }; + +(:~ + : Constructs a date given the hours, months and days. + TODO what happens when the params are not in range + : + : @see http://office.microsoft.com/en-us/excel/HP052090421033.aspxs + : @param $year the year + : @param $month the month + : @param $day the day + : @return A date given the hours, months and days + :) +declare function excel-datetime:date + ($year as xs:integer, + $month as xs:integer, + $day as xs:integer) as xs:date? { + + let $vyear := excel-text:pad-integer-to-length($year, "0", 4) + let $vmonth := excel-text:pad-integer-to-length($month, "0", 2) + let $vday := excel-text:pad-integer-to-length($day, "0", 2) + + return xs:date(fn:string-join(($vyear, $vmonth, $vday),"-")) + }; + +(: TODO what happens when the params are not in range :) +(:~ + : Constructs a time given the hours, minutes and seconds. + : + : @see http://office.microsoft.com/en-us/excel/HP052093151033.aspx + : @param $hour the hour. + : @param $minute the minute. + : @param $second the second. + : @return A time given the hours, minutes and seconds. + :) +declare function excel-datetime:time + ($hour as xs:integer, + $minute as xs:integer, + $second as xs:integer) as xs:time? { + + let $vhour := excel-text:pad-integer-to-length($hour, "0",2) + let $vminute := excel-text:pad-integer-to-length($minute, "0",2) + let $vsecond := excel-text:pad-integer-to-length($second, "0",2) + + return xs:time(fn:string-join(($vhour, $vminute,$vsecond),":")) + }; + +(:~ + : Returns the day of the week corresponding to a $date. + : + : @see http://office.microsoft.com/en-us/excel/HP052093151033.aspx + : @param $date the date. + : @return The day of the week corresponding to a $date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday). + :) +declare function excel-datetime:weekday + ($date as xs:date) as xs:integer? { + + excel-datetime:weekday($date, 1) +}; + +(:~ + : Returns the day of the week corresponding to a $date depending on $return_type. + : + : @see http://office.microsoft.com/en-us/excel/HP052093361033.aspx + : @param $date the date. + : @param $return_type 1 for Numbers 1 (Sunday) through 7 (Saturday). 2 for Numbers 1 (Monday) through 7 (Sunday). 3 for Numbers 0 (Monday) through 6 (Sunday). + : @error excel-err:Value if $return_type is outside the range [1,3]. + : @return The day of the week corresponding to a $date depending on $return_type. + :) +declare function excel-datetime:weekday + ($date as xs:date, + $return_type as xs:integer) as xs:integer? { + + if ($return_type eq 1) then + excel-datetime:day-of-week($date) + 1 + else if ($return_type eq 2) then + if (excel-datetime:day-of-week($date) eq 0) then 7 + else excel-datetime:day-of-week($date) + else if ($return_type eq 3) then + if(excel-datetime:day-of-week($date) eq 0) then 6 + else excel-datetime:day-of-week($date) - 1 + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided number must be in range [1,3]", $return_type) +}; + +(:~ + : Returns the number of whole working days between $start_date and $end_date. + : + : @see http://office.microsoft.com/en-us/excel/HP052091901033.aspx + : @param $start_date the start date. + : @param $end_date the end date. + : @return The number of whole working days between start_date and end_date.

+ : Working days exclude weekends and any dates identified in holidays.

+ : Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term. + :) +declare function excel-datetime:networkdays + ($start_date as xs:date, + $end_date as xs:date) as xs:integer* { + + excel-datetime:networkdays( $start_date, $end_date, ()) +}; + +(:~ + : Returns the number of whole working days between $start_date and $end_date. + : + : @see http://office.microsoft.com/en-us/excel/HP052091901033.aspx + : @param $start_date the start date. + : @param $end_date the end date. + : @param $holidays one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays. + : @return The number of whole working days between start_date and end_date.

+ : Working days exclude weekends and any dates identified in holidays.

+ : Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term. + :) +declare function excel-datetime:networkdays + ($start_date as xs:date, + $end_date as xs:date, + $holidays as xs:date*) as xs:integer* { + + let $days := fn:days-from-duration($end_date - $start_date) + 1 + + let $before := 8 - excel-datetime:day-of-week($start_date) + let $after := excel-datetime:day-of-week($end_date) + + let $working_days := (($days - $before - $after) idiv 7 )*5 + + (if(excel-datetime:day-of-week($start_date) < 7) then 6 - excel-datetime:day-of-week($start_date) else 0) + + (if($after < 6) then $after else if($after eq 6) then 5 else 0) + + let $hol := fn:count( for $date in $holidays + return if(($start_date lt $date) and + ($date lt $end_date) and + (excel-datetime:day-of-week($date) ne 6) and + (excel-datetime:day-of-week($date) ne 0)) then 1 + else ()) + + return $working_days - $hol +}; diff -Nru zorba-excel-module-2.9.1/src/engineering.xq zorba-excel-module-3.0.0/src/engineering.xq --- zorba-excel-module-2.9.1/src/engineering.xq 1970-01-01 00:00:00.000000000 +0000 +++ zorba-excel-module-3.0.0/src/engineering.xq 2013-11-07 17:11:01.000000000 +0000 @@ -0,0 +1,728 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2009 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. +:) + +(:~ + : This is a library module offering the same set of functions + : defined by Microsoft Excel, under Engineering Functions. + : + : @author Sorin Nasoi + : + : @see Excel Documentation: Engineering Functions + : + : @project Zorba/Excel/Engineering + :) +module namespace excel-engineering = "http://zorba.io/modules/excel/engineering" ; + +declare namespace excel-err = "http://zorba.io/modules/excel/errors"; + +(:~ + : Import excel-text module functions. + :) +import module namespace excel-text="http://zorba.io/modules/excel/text"; + +(:~ + : Import excel-math module functions. + :) +import module namespace excel-math="http://zorba.io/modules/excel/math"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + +(:~ + : Tests if a string is a hexadecimal representation of a number. + : + : @param $arg the string. + : @return True if the passed $arg is a hexadecimal number, false otherwise. + :) +declare %private function excel-engineering:is-hex + ($arg as xs:string) as xs:boolean { + + let $tmp := fn:upper-case($arg) + let $hexCP:=(48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70) + + return if (fn:exists(excel-text:value-except(fn:string-to-codepoints($tmp),($hexCP)))) then fn:false() + else fn:true() +}; + +(:~ + : Tests if a string is a octal representation of a number. + : + : @param $arg the string + : @return True if the passed $arg is a octal number, false otherwise. + :) +declare %private function excel-engineering:is-oct + ($arg as xs:string) as xs:boolean { + + let $octCP:=(48, 49, 50, 51, 52, 53, 54, 55) + + return if (fn:exists(excel-text:value-except(fn:string-to-codepoints($arg),($octCP)))) then fn:false() + else fn:true() +}; + +(:~ + : Tests if a string is a binary representation of a number. + : + : @param $arg the string. + : @return True if the passed $arg is a binary number, false otherwise. + :) +declare %private function excel-engineering:is-bin + ($arg as xs:string) as xs:boolean { + + let $binCP:=(48, 49) + + return if (fn:exists(excel-text:value-except(fn:string-to-codepoints($arg),($binCP)))) then fn:false() + else fn:true() +}; + +(:~ + : Returns a binary representation of a number. + : + : @param $number the number. + : @error excel-err:Value if provided value for $number is not numeric. + : @return A binary representation of a number. + :) +declare %private function excel-engineering:dec2hexUtil + ($number as xs:anyAtomicType) as xs:string { + + if (fn:not(excel-math:is-a-number($number))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $number) + else + let $tmpNumber := xs:integer($number) + + let $hexDigits:=('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F') + return + if($number < 16) then + $hexDigits[$number + 1] + else + fn:concat(excel-engineering:dec2hex($number idiv 16), excel-engineering:dec2hex($number mod 16)) +}; + +(:~ + : Returns an octal representation of a number. + : + : @param $number the number. + : @error excel-err:Value if provided value for $number is not numeric. + : @return An octal representation of a number. + :) +declare %private function excel-engineering:dec2octUtil + ($number as xs:anyAtomicType) as xs:string { + + if (fn:not(excel-math:is-a-number($number))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $number) + else + let $tmpNumber := xs:integer($number) + + let $octDigits:=('0', '1', '2', '3', '4', '5', '6', '7') + return + if($number < 8) then + $octDigits[$number + 1] + else + fn:concat(excel-engineering:dec2oct($number idiv 8), excel-engineering:dec2oct($number mod 8)) +}; + +(:~ + : Returns a binary representation of a number. + : + : @param $arg the number. + : @error excel-err:Value if provided value for $number is not numeric. + : @return A binary representation of a number. + :) +declare %private function excel-engineering:dec2binUtil + ($arg as xs:anyAtomicType) as xs:string { + + if (fn:not(excel-math:is-a-number($arg))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) + else + let $tmpNumber := xs:integer($arg) + + let $binDigits:=('0', '1') + return + if($tmpNumber < 2) then + $binDigits[$tmpNumber + 1] + else + fn:concat(excel-engineering:dec2binUtil($tmpNumber idiv 2), excel-engineering:dec2binUtil($tmpNumber mod 2)) +}; + +(:~ + : Returns a decimal representation of a number given it's hexadecimal representation. + : + : @param $arg the number. + : @error excel-err:Value if provided $arg is not a hexadecimal representation of a number. + : @return A decimal representation of a number given it's hexadecimal representation. + :) +declare %private function excel-engineering:hex2decUtil + ($arg as xs:string) as xs:integer* { + + let $number := fn:upper-case($arg) + let $hexCP := (48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70) + + return if (fn:not(excel-engineering:is-hex($number))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided string is not a hexadecimal representation of a number", $number) + else + let $tmp := fn:reverse(fn:string-to-codepoints($number)) + return fn:sum(for $val in (0 to fn:string-length($number)-1) + return (fn:index-of($hexCP, $tmp[$val + 1]) - 1) * excel-math:power(16, $val)) +}; + +(:~ + : Returns a decimal representation of a number given it's octal representation. + : + : @param $arg the number. + : @error excel-err:Value if provided $arg is not an octal representation of a number. + : @return A decimal representation of a number given it's octal representation. + :) +declare %private function excel-engineering:oct2decUtil + ($arg as xs:string) as xs:integer { + + if (fn:not(excel-engineering:is-oct($arg))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided string is not an octal representation of a number", $arg) + else + let $tmp := fn:reverse(fn:string-to-codepoints($arg)) + return fn:sum(for $val in (0 to fn:string-length($arg)-1) + return xs:integer(fn:codepoints-to-string($tmp[$val + 1])) * excel-math:power(8, $val)) +}; + +(:~ + : Returns a decimal representation of a number given it's binary representation. + : + : @param $arg the number. + : @error excel-err:Value if provided $arg is not an binary representation of a number. + : @return A decimal representation of a number given it's binary representation. + :) +declare %private function excel-engineering:bin2decUtil + ($arg as xs:string) as xs:integer { + + if (fn:not(excel-engineering:is-bin($arg))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided string is not a binary representation of a number", $arg) + else + let $tmp := fn:reverse(fn:string-to-codepoints($arg)) + return fn:sum(for $val in (0 to fn:string-length($arg)-1) + return xs:integer(fn:codepoints-to-string($tmp[$val + 1])) * excel-math:power(2, $val)) +}; + +(:~ + : Converts a decimal number to hexadecimal. + : + : @see http://office.microsoft.com/en-us/excel/HP052090541033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not numeric. + : @error excel-err:Num if provided value for $arg is smaller than -549755813888 or bigger than 549755813887 + : @return A hexadecimal representation of a number given it's decimal representation. + :) +declare function excel-engineering:dec2hex + ($arg as xs:anyAtomicType) as xs:string { + + if (fn:not(excel-math:is-a-number($arg))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) + else + let $tmpNumber := xs:integer($arg) + + return + if(($tmpNumber < -549755813888) or ($tmpNumber > 549755813887)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -549755813888 or bigger than 549755813887", $tmpNumber) + else if($tmpNumber < 0) then + let $tmp := 1 + excel-engineering:hex2decUtil(fn:translate( + excel-text:pad-integer-to-length(excel-engineering:dec2hexUtil(fn:abs($tmpNumber)), "0", 10), + "0123456789ABCDEF", + "FEDCBA9876543210")) + return excel-engineering:dec2hexUtil($tmp) + else + excel-engineering:dec2hexUtil($tmpNumber) +}; + +(:~ + : Converts a decimal number to hexadecimal. + : + : @see http://office.microsoft.com/en-us/excel/HP052090541033.aspx?pid=CH062528241033 + : @param $arg the number. + : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). + : @error excel-err:Value if provided value for $arg is not numeric. + : @error excel-err:Value if provided value for $places is not numeric. + : @error excel-err:Num if provided value for $places is zero or negative. + : @error excel-err:Num if provided value for $places is too small. + : @error excel-err:Num if provided value for $arg is smaller than -549755813888 or bigger than 549755813887. + : @return A hexadecimal representation of a number given it's decimal representation. + :) +declare function excel-engineering:dec2hex + ($arg as xs:anyAtomicType, + $places as xs:anyAtomicType) as xs:string { + + if (fn:not(excel-math:is-a-number($arg))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) + else if(fn:not(excel-math:is-a-number($places))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'places' is not numeric", $places) + else + let $tmpNumber := xs:integer($arg) + let $tmpPlaces := xs:integer($places) + + return + if(($tmpNumber < -549755813888) or ($tmpNumber > 549755813887)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -549755813888 or bigger than 549755813887", $tmpNumber) + else if($tmpPlaces < 1) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' is zero or negative", $tmpPlaces) + else + if($tmpNumber < 0) then + let $tmp := 1 + excel-engineering:hex2decUtil(fn:translate( + excel-text:pad-integer-to-length(excel-engineering:dec2hexUtil(fn:abs($tmpNumber)), "0", 10), + "0123456789ABCDEF", + "FEDCBA9876543210")) + return excel-engineering:dec2hexUtil($tmp) + else + let $tmp := excel-engineering:dec2hexUtil($tmpNumber) + return if($tmpPlaces < fn:string-length($tmp)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' too small", $tmpPlaces) + else + excel-text:pad-integer-to-length($tmp, "0", $tmpPlaces) +}; + +(:~ + : Converts a decimal number to octal. + : + : @see http://office.microsoft.com/en-us/excel/HP052090551033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not numeric. + : @error excel-err:Num if provided value for $arg is smaller than -536870912 or bigger than 536870911. + : @return An octal representation of a number given it's decimal representation. + :) +declare function excel-engineering:dec2oct + ($arg as xs:anyAtomicType) as xs:string { + + if (fn:not(excel-math:is-a-number($arg))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) + else + let $tmpNumber := xs:integer($arg) + + return + if(($tmpNumber < -536870912) or ($tmpNumber > 536870911)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -536870912 or bigger than 536870911", $tmpNumber) + else if($tmpNumber < 0) then + let $tmp := 1 + excel-engineering:oct2decUtil(fn:translate( + excel-text:pad-integer-to-length(excel-engineering:dec2octUtil(fn:abs($tmpNumber)), "0", 10), + "01234567", + "76543210")) + return excel-engineering:dec2octUtil($tmp) + else + excel-engineering:dec2octUtil($tmpNumber) +}; + +(:~ + : Converts a decimal number to octal. + : + : @see http://office.microsoft.com/en-us/excel/HP052090551033.aspx?pid=CH062528241033 + : @param $arg the number + : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). + : @error excel-err:Value if provided value for $arg is not numeric + : @error excel-err:Value if provided value for $places is not numeric + : @error excel-err:Num if provided value for $places is zero or negative + : @error excel-err:Num if provided value for $places is too small + : @error excel-err:Num if provided value for $arg is smaller than -536870912 or bigger than 536870911 + : @return An octal representation of a number given it's decimal representation. + :) +declare function excel-engineering:dec2oct + ($arg as xs:anyAtomicType, + $places as xs:anyAtomicType) as xs:string { + + if (fn:not(excel-math:is-a-number($arg))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) + else if(fn:not(excel-math:is-a-number($places))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'places' is not numeric", $places) + else + let $tmpNumber := xs:integer($arg) + let $tmpPlaces := xs:integer($places) + + return + if(($tmpNumber < -536870912) or ($tmpNumber > 536870911)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -536870912 or bigger than 536870911", $tmpNumber) + else if($tmpPlaces < 1) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' is zero or negative", $tmpPlaces) + else + if($tmpNumber < 0) then + let $tmp := 1 + excel-engineering:oct2decUtil(fn:translate( + excel-text:pad-integer-to-length(excel-engineering:dec2octUtil(fn:abs($tmpNumber)), "0", 10), + "01234567", + "76543210")) + return excel-engineering:dec2octUtil($tmp) + else + let $tmp := excel-engineering:dec2octUtil($tmpNumber) + return if($tmpPlaces < fn:string-length($tmp)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' too small", $tmpPlaces) + else + excel-text:pad-integer-to-length($tmp, "0", $tmpPlaces) +}; + +(:~ + : Converts a decimal number to binary. + : + : @see http://office.microsoft.com/en-us/excel/HP052090531033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not numeric. + : @error excel-err:Num if provided value for $arg is smaller than -512 or bigger than 511. + : @return A binary representation of a number given it's decimal representation. + :) +declare function excel-engineering:dec2bin + ($arg as xs:anyAtomicType) as xs:string { + + if (fn:not(excel-math:is-a-number($arg))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'number' is not numeric", $arg) + else + let $tmpNumber := xs:integer($arg) + + return + if(($tmpNumber < -512) or ($tmpNumber > 511)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -512 or bigger than 511", $tmpNumber) + else + if($tmpNumber < 0) then + let $tmp := 1 + excel-engineering:bin2decUtil(fn:translate( + excel-text:pad-integer-to-length(excel-engineering:dec2binUtil(fn:abs($tmpNumber)), "0", 10), + "01", + "10")) + return excel-engineering:dec2binUtil($tmp) + else + excel-engineering:dec2binUtil($tmpNumber) +}; + +(:~ + : Converts a decimal number to binary. + : + : @see http://office.microsoft.com/en-us/excel/HP052090531033.aspx?pid=CH062528241033 + : @param $arg the number. + : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). + : @error excel-err:Value if provided value for $arg is not numeric. + : @error excel-err:Value if provided value for $places is not numeric. + : @error excel-err:Num if provided value for $places is zero or negative. + : @error excel-err:Num if provided value for $places is too small. + : @error excel-err:Num if provided value for $arg is smaller than -512 or bigger than 511. + : @return A binary representation of a number given it's decimal representation. + :) +declare function excel-engineering:dec2bin + ($arg as xs:anyAtomicType, + $places as xs:anyAtomicType) as xs:string { + + if (fn:not(excel-math:is-a-number($arg))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"),"Provided value for 'number' is not numeric", $arg) + else if(fn:not(excel-math:is-a-number($places))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value for 'places' is not numeric", $places) + else + let $tmpNumber := xs:integer($arg) + let $tmpPlaces := xs:integer($places) + + return + if(($tmpNumber < -512) or ($tmpNumber > 511)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'number' is smaller than -512 or bigger than 511", $tmpNumber) + else if($tmpPlaces < 1) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' is zero or negative", $tmpPlaces) + else + if($tmpNumber < 0) then + let $tmp := 1 + excel-engineering:bin2decUtil(fn:translate( + excel-text:pad-integer-to-length(excel-engineering:dec2binUtil(fn:abs($tmpNumber)), "0", 10), + "01", + "10")) + return excel-engineering:dec2binUtil($tmp) + else + let $tmp := excel-engineering:dec2binUtil($tmpNumber) + return if($tmpPlaces < fn:string-length($tmp)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Provided value for 'places' too small", $tmpPlaces) + else + excel-text:pad-integer-to-length($tmp, "0", $tmpPlaces) +}; + +(:~ + : Converts an octal number to binary. + : + : @see http://office.microsoft.com/en-us/excel/HP052092001033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not an octal representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @return A binary representation of a number given it's octal representation. + :) +declare function excel-engineering:oct2bin + ($arg as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2bin(excel-engineering:oct2dec($arg)) +}; + +(:~ + : Converts an octal number to binary. + : + : @see http://office.microsoft.com/en-us/excel/HP052092001033.aspx?pid=CH062528241033 + : @param $arg the number. + : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). + : @error excel-err:Value if provided value for $arg is not an octal representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @error excel-err:Value if provided value for $places is not numeric. + : @error excel-err:Num if provided value for $places is zero or negative. + : @error excel-err:Num if provided value for $places is too small. + : @return A binary representation of a number given it's octal representation. + :) +declare function excel-engineering:oct2bin + ($arg as xs:anyAtomicType, + $places as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2bin(excel-engineering:oct2dec($arg),$places) +}; + +(:~ + : Converts an octal number to decimal. + : + : @see http://office.microsoft.com/en-us/excel/HP052092011033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not an octal representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @return A decimal representation of a number given it's octal representation. + :) +declare function excel-engineering:oct2dec + ($arg as xs:anyAtomicType) as xs:integer { + + let $number := fn:string($arg) + return if (fn:not(excel-engineering:is-oct($number))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided string is not an octal representation of a number", $number) + else if(fn:string-length($number) > 10) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Number contains more than 10 characters", $number) + else + if((fn:string-length($number) eq 10) and + fn:substring($number, 1, 1) eq "7") then + -(1 + excel-engineering:oct2decUtil(fn:translate($number,"01234567", "76543210"))) + else + excel-engineering:oct2decUtil($number) +}; + +(:~ + : Converts a binary number to decimal. + : + : @see http://office.microsoft.com/en-us/excel/HP052090021033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not a binary representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @return A decimal representation of a number given it's binary representation. + :) +declare function excel-engineering:bin2dec + ($arg as xs:anyAtomicType) as xs:integer { + + let $number := fn:string($arg) + return if (fn:not(excel-engineering:is-bin($number))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided string is not a binary representation of a number", $number) + else if(fn:string-length($number) > 10) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Number contains more than 10 characters", $number) + else + if((fn:string-length($number) eq 10) and + (fn:substring($number, 1, 1) eq "1")) then + -(1 + excel-engineering:bin2decUtil(fn:translate($number,"01", "10"))) + else + excel-engineering:bin2decUtil ($number) +}; + +(:~ + : Converts an octal number to hexadecimal. + : + : @see http://office.microsoft.com/en-us/excel/HP052092021033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not an octal representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @return A hexadecimal representation of a number given it's octal representation. + :) +declare function excel-engineering:oct2hex + ($arg as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2hex(excel-engineering:oct2dec($arg)) +}; + +(:~ + : Converts an octal number to hexadecimal. + : + : @see http://office.microsoft.com/en-us/excel/HP052092021033.aspx?pid=CH062528241033 + : @param $arg the number. + : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). + : @error excel-err:Value if provided value for $arg is not an octal representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @error excel-err:Value if provided value for $places is not numeric. + : @error excel-err:Num if provided value for $places is zero or negative. + : @error excel-err:Num if provided value for $places is too small. + : @return A hexadecimal representation of a number given it's octal representation. + :) +declare function excel-engineering:oct2hex + ($arg as xs:anyAtomicType, + $places as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2hex(excel-engineering:oct2dec($arg),$places) +}; + +(:~ + : Converts a hexadecimal number to binary. + : + : @see http://office.microsoft.com/en-us/excel/HP052091101033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not a hexadecimal representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @return A binary representation of a number given it's hexadecimal representation. + :) +declare function excel-engineering:hex2bin + ($arg as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2bin(excel-engineering:hex2dec($arg)) +}; + +(:~ + : Converts a hexadecimal number to binary. + : + : @see http://office.microsoft.com/en-us/excel/HP052091101033.aspx?pid=CH062528241033 + : @param $arg the number. + : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). + : @error excel-err:Value if provided value for $arg is not a hexadecimal representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @error excel-err:Value if provided value for $places is not numeric. + : @error excel-err:Num if provided value for $places is zero or negative. + : @error excel-err:Num if provided value for $places is too small. + : @return A binary representation of a number given it's hexadecimal representation. + :) +declare function excel-engineering:hex2bin + ($arg as xs:anyAtomicType, + $places as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2bin(excel-engineering:hex2dec($arg),$places) +}; + +(:~ + : Converts a hexadecimal number to octal. + : + : @see http://office.microsoft.com/en-us/excel/HP052091121033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not a hexadecimal representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @return A octal representation of a number given it's hexadecimal representation. + :) +declare function excel-engineering:hex2oct + ($arg as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2oct(excel-engineering:hex2dec($arg)) +}; + +(:~ + : Converts a hexadecimal number to octal. + : + : @see http://office.microsoft.com/en-us/excel/HP052091121033.aspx?pid=CH062528241033 + : @param $arg the number. + : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). + : @error excel-err:Value if provided value for $arg is not a hexadecimal representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @error excel-err:Value if provided value for $places is not numeric. + : @error excel-err:Num if provided value for $places is zero or negative. + : @error excel-err:Num if provided value for $places is too small. + : @return A octal representation of a number given it's hexadecimal representation. + :) +declare function excel-engineering:hex2oct + ($arg as xs:anyAtomicType, + $places as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2oct(excel-engineering:hex2dec($arg),$places) +}; + +(:~ + : Converts a hexadecimal number to decimal. + : + : @see http://office.microsoft.com/en-us/excel/HP052091111033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not a hexadecimal representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @return A decimal representation of a number given it's hexadecimal representation. + :) +declare function excel-engineering:hex2dec + ($arg as xs:string) as xs:integer { + + let $number := fn:upper-case($arg) + return if (fn:not(excel-engineering:is-hex($number))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided string is not a hexadecimal representation of a number", $arg) + else if(fn:string-length($number) > 10) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Number contains more than 10 characters", $arg) + else + if((fn:string-length($number) eq 10) and + fn:substring($number, 1, 1) eq "F") then + -(1 + excel-engineering:hex2decUtil(fn:translate($number,"0123456789ABCDEF", "FEDCBA9876543210"))) + else + excel-engineering:hex2decUtil($number) +}; + +(:~ + : Converts a binary number to octal. + : + : @see http://office.microsoft.com/en-us/excel/HP052090041033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not a binary representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @return A octal representation of a number given it's binary representation. + :) +declare function excel-engineering:bin2oct + ($arg as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2oct(excel-engineering:bin2dec($arg)) +}; + +(:~ + : Converts a binary number to octal. + : + : @see http://office.microsoft.com/en-us/excel/HP052090041033.aspx?pid=CH062528241033 + : @param $arg the number. + : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). + : @error excel-err:Value if provided value for $arg is not a binary representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @error excel-err:Value if provided value for $places is not numeric. + : @error excel-err:Num if provided value for $places is zero or negative. + : @error excel-err:Num if provided value for $places is too small. + : @return A octal representation of a number given it's binary representation. + :) +declare function excel-engineering:bin2oct + ($arg as xs:anyAtomicType, + $places as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2oct(excel-engineering:bin2dec($arg),$places) +}; + +(:~ + : Converts a binary number to hexadecimal. + : + : @see http://office.microsoft.com/en-us/excel/HP052090031033.aspx?pid=CH062528241033 + : @param $arg the number. + : @error excel-err:Value if provided value for $arg is not a binary representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @return A hexadecimal representation of a number given it's binary representation. + :) +declare function excel-engineering:bin2hex + ($arg as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2hex(excel-engineering:bin2dec($arg)) +}; + +(:~ + : Converts a binary number to hexadecimal. + : + : @see http://office.microsoft.com/en-us/excel/HP052090031033.aspx?pid=CH062528241033 + : @param $arg the number. + : @param $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros). + : @error excel-err:Value if provided value for $arg is not a binary representation of a number. + : @error excel-err:Value if provided value for $arg contains more than 10 characters. + : @error excel-err:Value if provided value for $places is not numeric. + : @error excel-err:Num if provided value for $places is zero or negative. + : @error excel-err:Num if provided value for $places is too small. + : @return A hexadecimal representation of a number given it's binary representation. + :) +declare function excel-engineering:bin2hex + ($arg as xs:anyAtomicType, + $places as xs:anyAtomicType) as xs:string { + + excel-engineering:dec2hex(excel-engineering:bin2dec($arg),$places) +}; diff -Nru zorba-excel-module-2.9.1/src/information.xq zorba-excel-module-3.0.0/src/information.xq --- zorba-excel-module-2.9.1/src/information.xq 1970-01-01 00:00:00.000000000 +0000 +++ zorba-excel-module-3.0.0/src/information.xq 2013-11-07 17:11:01.000000000 +0000 @@ -0,0 +1,160 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2009 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. +:) + +(:~ + : This is a library module offering the same set of functions + : defined by Microsoft Excel, under Information Functions. + : + : @author Sorin Nasoi + : + : @see Excel Documentation: Information Functions + : + : @project Zorba/Excel/Information + :) +module namespace excel-information = "http://zorba.io/modules/excel/information" ; + +declare namespace excel-err = "http://zorba.io/modules/excel/errors"; + +(:~ + : Import excel-math module functions. + :) +import module namespace excel-math = "http://zorba.io/modules/excel/math"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + + +(:~ + : Test if the passed argument is empty of not. + : + : @see http://www.w3.org/TR/xquery-operators/#func-empty + : @param $value the value. + : @return If the value of $arg is the empty sequence, the function returns true, otherwise the function returns false. + :) +declare function excel-information:is-blank + ( $value as xs:anyAtomicType? ) as xs:boolean { + fn:empty($value) + }; + +(:~ + : Test is a number is even. + : + : @see http://office.microsoft.com/en-us/excel/HP052091481033.aspx + : @param $value the value. + : @error excel-err:Value if provided value is not a number. + : @return TRUE if number is even, FALSE if number is odd. + :) +declare function excel-information:is-even + ( $value as xs:anyAtomicType? ) as xs:boolean { + + if(excel-math:is-a-number($value)) then + fn:not(fn:boolean(fn:floor(fn:abs(fn:number($value))) mod 2)) + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value is not a number", $value) + }; + +(:~ + : Test is a number is odd. + : + : @see http://office.microsoft.com/en-us/excel/HP052091491033.aspx + : @param $value the value. + : @error excel-err:Value if provided value is not a number. + : @return TRUE if number is odd, FALSE if number is even. + :) +declare function excel-information:is-odd + ( $value as xs:anyAtomicType? ) as xs:boolean { + + if(excel-math:is-a-number($value)) then + fn:boolean(fn:floor(fn:abs(fn:number($value))) mod 2) + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value is not a number", $value) + }; + +(:~ + : Tests if the passed $value is a logical value. + : + : @see http://office.microsoft.com/en-us/excel/HP052091471033.aspx + : @param $value the value. + : @return TRUE if $value refers to a logical value. + :) +declare function excel-information:islogical + ( $value as xs:anyAtomicType? ) as xs:boolean { + + if ($value instance of xs:boolean) then fn:true() + else fn:false() + }; + +(:~ + : Tests if the passed $value is a number. + : + : @see http://office.microsoft.com/en-us/excel/HP052091471033.aspx + : @param $value the value. + : @return TRUE if $value refers to a number. + :) +declare function excel-information:isnumber + ( $value as xs:anyAtomicType? ) as xs:boolean { + + if (($value instance of xs:integer) or + ($value instance of xs:decimal) or + ($value instance of xs:float) or + ($value instance of xs:double)) then fn:true() + else fn:false() + }; + +(:~ + : Tests if the passed $value is a string. + : + : @see http://office.microsoft.com/en-us/excel/HP052091471033.aspx + : @param $value the value. + : @return TRUE if $value refers to text. + :) +declare function excel-information:istext + ( $value as xs:anyAtomicType? ) as xs:boolean { + + if ($value instance of xs:string) then fn:true() + else fn:false() + }; + +(:~ + : Converts a $value to a number. + : + : @see http://office.microsoft.com/en-us/excel/HP052091871033.aspx + : @param $value the value. + : @return A $value converted to a number. + :) +declare function excel-information:n + ( $value as xs:anyAtomicType? ) as xs:anyAtomicType { + + if( excel-information:isnumber($value)) then $value + else if( excel-information:islogical($value)) then $value cast as xs:integer + else 0 + }; + +(:~ + : Raises the error value #N/A. + : + : @see http://office.microsoft.com/en-us/excel/HP052091881033.aspx + : @error excel-err:NA the purpose of this function is to raise this error + : @return The error value #N/A. #N/A is the error value that means "no value is available." + :) +declare function excel-information:na + () as xs:anyAtomicType { + + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "No value is available") + }; diff -Nru zorba-excel-module-2.9.1/src/logical.xq zorba-excel-module-3.0.0/src/logical.xq --- zorba-excel-module-2.9.1/src/logical.xq 1970-01-01 00:00:00.000000000 +0000 +++ zorba-excel-module-3.0.0/src/logical.xq 2013-11-07 17:11:01.000000000 +0000 @@ -0,0 +1,120 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2009 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. +:) + +(:~ + : This is a library module offering the same set of functions + : defined by Microsoft Excel, under Logical Functions. + : + : @author Sorin Nasoi + : + : @see Excel Documentation: Logical Functions + : @project Zorba/Excel/Logical + : + :) +(: for False,Not and True use fn:false(), fn:not(), fn:true() :) + +module namespace excel-logical = "http://zorba.io/modules/excel/logical" ; + +declare namespace excel-err = "http://zorba.io/modules/excel/errors"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + +(:~ + : Returns TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE. + : + : @see http://office.microsoft.com/en-us/excel/HP052089861033.aspx + : @param $arg1 the first argument. + : @param $arg2 the second argument. + : @return TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE. + :) +declare function excel-logical:and + ( $arg1 as xs:anyAtomicType, + $arg2 as xs:anyAtomicType) as xs:boolean { + fn:boolean(($arg1 and $arg2)) + }; + +(:~ + : Returns TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE. + : + : @see http://office.microsoft.com/en-us/excel/HP052089861033.aspx + : @param $values the sequence of arguments. + : @error excel-err:Value provided sequence is empty. + : @return TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE. + :) +declare function excel-logical:and + ( $values as xs:anyAtomicType* ) as xs:boolean { + let $distValues := distinct-values($values) + return + if(fn:empty($distValues)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided sequence is empty", $values) + else + every $value in $distValues satisfies $value eq fn:true() + }; + +(:~ + : Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. + : + : @see http://office.microsoft.com/en-us/excel/HP052091181033.aspx + : @param $logical_test is any value or expression that can be evaluated to TRUE or FALSE. + : @param $value_if_true the value that is returned if logical_test is TRUE. + : @param $value_if_false the value that is returned if logical_test is FALSE. + : @return One value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. + :) +declare function excel-logical:if + ( $logical_test as xs:boolean, + $value_if_true as item()*, + $value_if_false as item()*) as item()* { + if($logical_test) then + $value_if_true + else + $value_if_false + }; + +(:~ + : Returns TRUE if any argument is TRUE; FALSE if all arguments are FALSE. + : + : @see http://office.microsoft.com/en-us/excel/HP052092091033.aspx + : @param $arg1 the first argument. + : @param $arg2 the second argument. + : @return TRUE if any argument is TRUE; FALSE if all arguments are FALSE. + :) +declare function excel-logical:or + ( $arg1 as xs:anyAtomicType, + $arg2 as xs:anyAtomicType) as xs:boolean { + fn:boolean(($arg1 or $arg2)) + }; + +(:~ + : Returns TRUE if any argument is TRUE; FALSE if all arguments are FALSE. + : + : @see http://office.microsoft.com/en-us/excel/HP052092091033.aspx + : @param $values the sequence of arguments. + : @error excel-err:Value provided sequence is empty. + : @return TRUE if any argument is TRUE; FALSE if all arguments are FALSE. + :) +declare function excel-logical:or + ( $values as xs:anyAtomicType* ) as xs:boolean { + let $distValues := distinct-values($values) + return + if(fn:empty($distValues)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided sequence is empty", $values) + else + some $value in $distValues satisfies $value eq fn:true() + }; diff -Nru zorba-excel-module-2.9.1/src/lookup.xq zorba-excel-module-3.0.0/src/lookup.xq --- zorba-excel-module-2.9.1/src/lookup.xq 1970-01-01 00:00:00.000000000 +0000 +++ zorba-excel-module-3.0.0/src/lookup.xq 2013-11-07 17:11:01.000000000 +0000 @@ -0,0 +1,841 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2009 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. + :) + +(:~ + : This module implements some Excel 2003 lookup functions. + : + : @see Excel 2003 Documentation: Lookup Functions + : + : @author Daniel Turcanu + : @project Zorba/Excel/Lookup + : + :) +module namespace excel = "http://zorba.io/modules/excel/lookup" ; + +declare namespace excel-err = "http://zorba.io/modules/excel/errors"; +(:~ + : Use excel-math module functions. + :) +import module namespace excel-math="http://zorba.io/modules/excel/math"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + +(:~ + : Uses index_num to return a value from the sequence of value arguments. + : + : @see http://office.microsoft.com/en-us/excel/HP052090131033.aspx + : @param $index_num The position in the sequence, 1 based. + : @param $values The sequence of values. + : @return The value at the index position. + : @error excel-err:Value if index is smaller than 1 or bigger than the size of sequence. + : @example test/Queries/excel/lookup/choose1.xq + :) +declare function excel:choose( + $index_num as xs:integer, + $values as xs:anyAtomicType*) as xs:anyAtomicType +{ + if ($index_num lt 1 or $index_num gt fn:count($values)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Choose function: index_num should be between 1 and value count ", $index_num) + else + $values[$index_num] +}; + +(:~ + : Uses index_num to return a sequence from the list of sequences. + : Use CHOOSE to select one of up to 29 sequences based on the index number. + : + : @see http://office.microsoft.com/en-us/excel/HP052090131033.aspx + : @param $index_num the position in the sequence, 1 based + : @param $value_sequence1 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence2 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence3 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence4 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence5 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence6 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence7 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence8 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence9 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence10 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence11 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence12 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence13 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence14 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence15 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence16 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence17 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence18 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence19 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence20 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence21 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence22 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence23 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence24 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence25 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence26 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence27 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence28 a sequence of values. Specify the empty sequence () if you don't need it. + : @param $value_sequence29 a sequence of values. Specify the empty sequence () if you don't need it. + : @return The value at the index position + : @error excel-err:Value if index is smaller than 1 or bigger than 29 + : @example test/Queries/excel/lookup/choose2.xq + :) +declare function excel:choose( + $index_num as xs:integer, + $value_sequence1 as xs:anyAtomicType*, + $value_sequence2 as xs:anyAtomicType*, + $value_sequence3 as xs:anyAtomicType*, + $value_sequence4 as xs:anyAtomicType*, + $value_sequence5 as xs:anyAtomicType*, + $value_sequence6 as xs:anyAtomicType*, + $value_sequence7 as xs:anyAtomicType*, + $value_sequence8 as xs:anyAtomicType*, + $value_sequence9 as xs:anyAtomicType*, + $value_sequence10 as xs:anyAtomicType*, + $value_sequence11 as xs:anyAtomicType*, + $value_sequence12 as xs:anyAtomicType*, + $value_sequence13 as xs:anyAtomicType*, + $value_sequence14 as xs:anyAtomicType*, + $value_sequence15 as xs:anyAtomicType*, + $value_sequence16 as xs:anyAtomicType*, + $value_sequence17 as xs:anyAtomicType*, + $value_sequence18 as xs:anyAtomicType*, + $value_sequence19 as xs:anyAtomicType*, + $value_sequence20 as xs:anyAtomicType*, + $value_sequence21 as xs:anyAtomicType*, + $value_sequence22 as xs:anyAtomicType*, + $value_sequence23 as xs:anyAtomicType*, + $value_sequence24 as xs:anyAtomicType*, + $value_sequence25 as xs:anyAtomicType*, + $value_sequence26 as xs:anyAtomicType*, + $value_sequence27 as xs:anyAtomicType*, + $value_sequence28 as xs:anyAtomicType*, + $value_sequence29 as xs:anyAtomicType*) as xs:anyAtomicType* +{ + if ($index_num lt 1 or $index_num gt 29) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Choose function: index_num should be between 1 and 29 ", $index_num) + else if ($index_num = 1) then + $value_sequence1 + else if ($index_num = 2) then + $value_sequence2 + else if ($index_num = 3) then + $value_sequence3 + else if ($index_num eq 4) then + $value_sequence4 + else if ($index_num eq 5) then + $value_sequence5 + else if ($index_num eq 6) then + $value_sequence6 + else if ($index_num eq 7) then + $value_sequence7 + else if ($index_num eq 8) then + $value_sequence8 + else if ($index_num eq 9) then + $value_sequence9 + else if ($index_num eq 10) then + $value_sequence10 + else if ($index_num eq 11) then + $value_sequence11 + else if ($index_num eq 12) then + $value_sequence12 + else if ($index_num eq 13) then + $value_sequence13 + else if ($index_num eq 14) then + $value_sequence14 + else if ($index_num eq 15) then + $value_sequence15 + else if ($index_num eq 16) then + $value_sequence16 + else if ($index_num eq 17) then + $value_sequence17 + else if ($index_num eq 18) then + $value_sequence18 + else if ($index_num eq 19) then + $value_sequence19 + else if ($index_num eq 20) then + $value_sequence20 + else if ($index_num eq 21) then + $value_sequence21 + else if ($index_num eq 22) then + $value_sequence22 + else if ($index_num eq 23) then + $value_sequence23 + else if ($index_num eq 24) then + $value_sequence24 + else if ($index_num eq 25) then + $value_sequence25 + else if ($index_num eq 26) then + $value_sequence26 + else if ($index_num eq 27) then + $value_sequence27 + else if ($index_num eq 28) then + $value_sequence28 + else if ($index_num eq 29) then + $value_sequence29 + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Choose function: index_num should be between 1 and 29 ", $index_num) +}; + +(:~ + : Function for HLOOKUP, LOOKUP, MATCH, VLOOKUP. + : This function should not be used outside this module. + : It searches a lookup_value in table_header with three different algorithms + : specified by range_lookup. + : + : @param $lookup_value the value to be searched. + : Allowed types are numeric, string, boolean. + : Boolean values are compared only with booleans. + : Numbers are compared only with numbers, if range_lookup is not zero. + : The other types are converted to string and compared to string value of all values. + : @param $table_header the sequence of values where to search + : @param $range_lookup specified the algorithm for searching. + : Can have values: + : 1 = finds the largest value that is less than or equal to lookup_value. + : Table_header must be in ascending order. + : 0 = finds the first value that is exactly equal to lookup_value. + : Table_header can be in any order. + : If lookup_value is boolean, then only booleans are compared. + : For other types, they are casted to string and then compared using + : xquery regular expressions. Lookup_value can be a xquery regular expression. + : -1 = finds the smallest value that is greater than or equal to lookup_value. + : Table_header must be in descending order. + : @param $pos the current position in original table_header + : @param $last_comparable_pos the position of last value that might be a match + : @return the value found + : @error excel-err:Value if range_lookup=0 and the value cannot be found + :) +declare %private function excel:lookup-column( + $lookup_value as xs:anyAtomicType, + $table_header as xs:anyAtomicType*, + $range_lookup as xs:integer, + $pos as xs:integer, + $last_comparable_pos as xs:integer) as xs:integer +{ + if (fn:empty($table_header)) then + if ($range_lookup != 0) then + $last_comparable_pos + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Hlookup function: cannot find lookup value ", $lookup_value) + else if ($range_lookup gt 0) then + if ($lookup_value instance of xs:boolean) then + if ($table_header[1] instance of xs:boolean) then + if ($lookup_value = $table_header[1]) then + $pos + 1 + else if ($lookup_value < $table_header[1]) then + $last_comparable_pos + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $last_comparable_pos) + else if (excel-math:is-a-number($lookup_value)) then + if (excel-math:is-a-number($table_header[1])) then + let $lookup_value_num := excel-math:cast-as-numeric($lookup_value) + let $table_header_num := excel-math:cast-as-numeric($table_header[1]) + return + if ($lookup_value_num = $table_header_num) then + $pos + 1 + else if ($lookup_value_num < $table_header_num) then + $last_comparable_pos + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $last_comparable_pos) + else + let $compare := fn:compare(fn:upper-case(fn:string($lookup_value)), + fn:upper-case(fn:string($table_header[1]))) + return + if ($compare eq 0) then + $pos + 1 + else if ($compare lt 0) then + $last_comparable_pos + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) + else if ($range_lookup lt 0) then + if ($lookup_value instance of xs:boolean) then + if ($table_header[1] instance of xs:boolean) then + if ($lookup_value = $table_header[1]) then + $pos + 1 + else if ($lookup_value > $table_header[1]) then + $last_comparable_pos + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $last_comparable_pos) + else if (excel-math:is-a-number($lookup_value)) then + if (excel-math:is-a-number($table_header[1])) then + let $lookup_value_num := excel-math:cast-as-numeric($lookup_value) + let $table_header_num := excel-math:cast-as-numeric($table_header[1]) + return + if ($lookup_value_num = $table_header_num) then + $pos + 1 + else if ($lookup_value_num > $table_header_num) then + $last_comparable_pos + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $last_comparable_pos) + else + let $compare := fn:compare(fn:upper-case(fn:string($lookup_value)), + fn:upper-case(fn:string($table_header[1]))) + return + if ($compare eq 0) then + $pos + 1 + else if ($compare gt 0) then + $last_comparable_pos + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, $pos + 1) + else if ($lookup_value instance of xs:boolean) then + if ($table_header[1] instance of xs:boolean) then + if ($lookup_value = $table_header[1]) then + $pos + 1 + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, 0) + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, 0) + else if (fn:matches(fn:upper-case(fn:string($table_header[1])), + fn:upper-case(fn:string($lookup_value)))) then + $pos + 1 + else + excel:lookup-column($lookup_value, fn:subsequence($table_header, 2), $range_lookup, $pos + 1, 0) +}; + +(:~ + : Searches for a value in the top row of an array of values, + : and then returns a value in the same column from a row you specify in the array. + :

Array is specified with 3 parameters: + :
table_array
is a sequence of elements, first row first, then second row and so on
+ :
table_width
specifies the number of elements in a row
+ :
table_height
specifies the number of rows
+ : The number of elements in table_array must be equal or more than table_width * table_height.

+ : + : For wildchar matching, the XQuery regex matcher is used. + : + : @see http://office.microsoft.com/en-us/excel/HP052091141033.aspx + : @param $lookup_value the value to be searched. + : Allowed types are numeric, string, boolean.

+ : Boolean values are compared only with booleans. + : Numbers are compared only with numbers, if range_lookup is not zero. + : The other types are converted to string and compared to string value of all values. + : @param $table_array the sequence of values, row after row + : @param $table_width the number of values in a row + : @param $table_height the number of rows + : @param $row_index_num the row index, 1 based + : @param $range_lookup

specifies the algorithm to use: + :
true
find approximative match. + : First row of array must be sorted in ascending order.
+ :
false
find exact match, using xquery regex + : First row of array can be in any order.
+ : @return The value found, with original type + : @error excel-err:Value if the array contains less elements than specified by table_height and table_width + : @error excel-err:Value if row_index_num is outside the range 1 .. table_height + : @error excel-err:Value if range_lookup is true and the value searched is smaller than + : the first value in the header + : @error excel-err:Value if range_lookup=false and the value cannot be found + : @example test/Queries/excel/lookup/hlookup1.xq + : @example test/Queries/excel/lookup/hlookup2.xq + : @example test/Queries/excel/lookup/hlookup3.xq + : @example test/Queries/excel/lookup/hlookup4.xq + : @example test/Queries/excel/lookup/hlookup5.xq + :) +declare function excel:hlookup( + $lookup_value as xs:anyAtomicType, + $table_array as xs:anyAtomicType+, + $table_width as xs:integer, + $table_height as xs:integer, + $row_index_num as xs:integer, + $range_lookup as xs:boolean) as xs:anyAtomicType +{ + if ($table_height * $table_width gt fn:count($table_array)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Hlookup function: table array width and height not specified correctly ", $table_width * 1000 + $table_height) + else if ($row_index_num lt 1 or $row_index_num gt $table_height) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Hlookup function: row_index_num must be between 1 and table height ", $row_index_num) + else + let $table_header := ( + for $i in (1 to $table_width) + return + $table_array[$i] + ) + let $column := excel:lookup-column($lookup_value, $table_header, $range_lookup cast as xs:integer, 0, 0) + return + if ($column eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Hlookup function: lookup value is smaller than the first element in header", $lookup_value) + else if ($column gt $table_width) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Hlookup function: column found outside table array ", $column) + else + $table_array[($row_index_num - 1) * $table_width + $column] +}; + +(:~ + : Same as above, only that range_lookup is defaulted to true. + : That is, this Hlookup looks for the approximate value + : and the first row must be ordered ascending. + : @see http://office.microsoft.com/en-us/excel/HP052091141033.aspx + : @param $lookup_value the value to be searched. + : Allowed types are numeric, string, boolean.

+ : Boolean values are compared only with booleans. + : Numbers are compared only with numbers, if range_lookup is not zero. + : The other types are converted to string and compared to string value of all values. + : @param $table_array the sequence of values, row after row + : @param $table_width the number of values in a row + : @param $table_height the number of rows + : @param $row_index_num the row index, 1 based + : @return The value found, with original type + : @error excel-err:Value if the array contains less elements than specified by table_height and table_width + : @error excel-err:Value if row_index_num is outside the range 1 .. table_height + : @error excel-err:Value if range_lookup is true and the value searched is smaller than + : the first value in the header + : @error excel-err:Value if range_lookup=false and the value cannot be found + :) +declare function excel:hlookup( + $lookup_value as xs:anyAtomicType, + $table_array as xs:anyAtomicType+, + $table_width as xs:integer, + $table_height as xs:integer, + $row_index_num as xs:integer) as xs:anyAtomicType +{ + excel:hlookup($lookup_value, $table_array, $table_width, $table_height, + $row_index_num, fn:true()) +}; + +(:~ + : Returns a value from within an array.

+ : This is the Array form of the Excel Index function.

+ : + :

Array is specified with 3 parameters: + :
array
is a sequence of elements, first row first, then second row and so on
+ :
array_height
specifies the number of rows
+ :
array_width
specifies the number of elements in a row
+ : The number of elements in array must be equal or more than array_width * array_height. + : + : @see http://office.microsoft.com/en-us/excel/HP052091381033.aspx + : @param $array the sequence of values, row after row + : @param $array_width the number of values in a row + : @param $array_height the number of rows + : @param $row_num the row position of the value, 1 based + : @param $column_num the column position of the value, 1 based + : @return The value from x-y in the array + : @error excel-err:Value if the array contains less elements than specified by table_height and table_width + : @error excel-err:Ref if row_num is outside the range + : @example test/Queries/excel/lookup/index1.xq + : @example test/Queries/excel/lookup/index2.xq + : @example test/Queries/excel/lookup/index3.xq + : @example test/Queries/excel/lookup/index4.xq + : @example test/Queries/excel/lookup/index5.xq +:) +declare function excel:index( + $array as xs:anyAtomicType+, + $array_height as xs:integer, + $array_width as xs:integer, + $row_num as xs:integer, + $column_num as xs:integer) as xs:anyAtomicType+ +{ + if ($array_height * $array_width != fn:count($array)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Index function: array width and height not specified correctly ", $array_width * 1000 + $array_height) + else + if ($row_num < 0 or $row_num > $array_height) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Ref"), "Index function: row_num must be between 1 and array height or 0", $row_num) + else + if ($column_num < 0 or $column_num > $array_width) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Ref"), "Index function: column_num must be between 1 and array width or 0", $column_num) + else + if ($array_height = 1) then + if ($column_num ge 1) then + $array[$column_num] + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Ref"), "Index function: column_num must be between 1 and array width", $column_num) + else + if ($array_width = 1) then + if ($row_num ge 1) then + $array[$row_num] + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Ref"), "Index function: row_num must be between 1 and array width", $row_num) + else + if ($row_num > 0 and $column_num > 0) then + $array[($row_num - 1) * $array_width + $column_num] + else + if ($column_num = 0) then + for $i in (1 to $array_width) return + $array[($row_num - 1)* $array_width + $i] + else + for $i in (1 to $array_height) return + $array[($i - 1) * $array_width + $column_num] +}; + +(:~ + : The Vector form.

+ : Looks in a sequence for a value + : and return a value from the same position in a second sequence. + : If the value is not found, then it matches the largest value in lookup_vector + : that is less than or equal to lookup_value. + : + : @see http://office.microsoft.com/en-us/excel/HP052091631033.aspx + : @param $lookup_value the value to be searched + : @param $lookup_vector the sequence to be searched, in ascending order. + : @param $result_vector the sequence containing the result values + : @return a value from $result_vector + : @error excel-err:NA if lookup value is smaller than the first value in lookup_vector + : @error excel-err:NA if position found is outside the result range + : @example test/Queries/excel/lookup/lookup1.xq + : @example test/Queries/excel/lookup/lookup2.xq + : @example test/Queries/excel/lookup/lookup3.xq + : @example test/Queries/excel/lookup/lookup4.xq + :) +declare function excel:lookup( + $lookup_value as xs:anyAtomicType, + $lookup_vector as xs:anyAtomicType+, + $result_vector as xs:anyAtomicType+) as xs:anyAtomicType +{ + let $pos := excel:lookup-column($lookup_value, $lookup_vector, 1, 0, 0) return + if ($pos eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Lookup function: lookup value is smaller than any vector values ", $lookup_value) + else if ($pos gt fn:count($result_vector)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Lookup function: lookup position is outside the result range ", $pos) + else + $result_vector[$pos] +}; + +(:~ + : The Array form.

+ : It looks in the first row or column of an array for the specified value + : and returns a value from the same position in the last row or column of the array.

+ : If array covers an area that is wider than it is tall (more columns than rows), + : LOOKUP searches for lookup_value in the first row.

+ : If array is square or is taller than it is wide (more rows than columns), + : LOOKUP searches in the first column.

+ : + : The values in the first row or first column must be in ascending order. + : + : @see http://office.microsoft.com/en-us/excel/HP052091631033.aspx + : @param $lookup_value the value to be searched. + : If the value is not found, then it matches the largest value in lookup_vector + : that is less than or equal to lookup_value. + : @param $array the array sequence, row after row + : @param $array_width the number of values in a row + : @param $array_height the number of rows in the array + : @return The corresponding value in the last row or column + : @error excel-err:Value if array contains less values than specified by array_width and array_height + : or array_width = 0 or array_height = 0 + : @error excel-err:NA if the lookup_value is smaller than the first value in the row or column + : @example test/Queries/excel/lookup/lookup5.xq + : @example test/Queries/excel/lookup/lookup6.xq + : @example test/Queries/excel/lookup/lookup7.xq + :) +declare function excel:lookup( + $lookup_value as xs:anyAtomicType, + $array as xs:anyAtomicType+, + $array_width as xs:integer, + $array_height as xs:integer) as xs:anyAtomicType +{ + if ($array_height * $array_width ne fn:count($array) or $array_height eq 0 or $array_width eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Lookup function: array width and height not specified correctly ", $array_width * 1000 + $array_height) + else if ($array_width gt $array_height) then + let $header := ( + for $i in (1 to $array_width) + return + $array[$i] + ) + let $pos := excel:lookup-column($lookup_value, $header, 1, 0, 0) + return + if ($pos eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Lookup function: lookup value is smaller than any vector values in the first row ", $lookup_value) + else + $array[($array_height - 1) * $array_width + $pos] + else + let $header := ( + for $i in (1 to $array_height) + return + $array[($i - 1) * $array_width + 1] + ) + let $pos := excel:lookup-column($lookup_value, $header, 1, 0, 0) + return + if ($pos eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Lookup function: lookup value is smaller than any vector values in the first column ", $lookup_value) + else + $array[($pos - 1) * $array_width + $array_width] +}; + +(:~ + : Returns the relative position of an item in a sequence that + : matches a specified value in a specified order. + : Only for one dimensional vector. + : + : @see http://office.microsoft.com/en-us/excel/HP052091681033.aspx + : @param $lookup_value value to be searched. + : @param $sequence the vector where to search the value + : @param $match_type

specifies the algorithm used for searching. + : Possible values: + :
1
finds the largest value that is less than or equal to lookup_value. + : Sequence must be in ascending order.
+ :
0
finds the first value that is exactly equal to lookup_value.

+ : Sequence can be in any order.

+ : If lookup_value is boolean, then only booleans are compared.

+ : For other types, they are casted to string and then compared using + : xquery regular expressions. Lookup_value can be a xquery regular expression.

+ :
-1
finds the smallest value that is greater than or equal to lookup_value.

+ : Sequence must be in descending order.

+ : @return The position of found value + : @error excel-err:NA for match_type 1 or -1, the lookup_value is smaller or larger than + : the first value in sequence + : @error excel-err:Value if range_lookup=0 and the value cannot be found + : @example test/Queries/excel/lookup/match2.xq + : @example test/Queries/excel/lookup/match3.xq + :) +declare function excel:match( + $lookup_value as xs:anyAtomicType, + $sequence as xs:anyAtomicType+, + $match_type as xs:integer) as xs:anyAtomicType +{ + let $pos := excel:lookup-column($lookup_value, $sequence, $match_type, 0, 0) + return + if ($pos eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Match function: cannot match lookup value ", $lookup_value) + else + $pos +}; + +(:~ + : Same as above, but match_type is defaulted to 1. + : It finds the largest value that is less than or equal to lookup_value. + : @see http://office.microsoft.com/en-us/excel/HP052091681033.aspx + : @param $lookup_value value to be searched. + : @param $sequence the vector where to search the value + : @return The position of found value + : @error excel-err:NA for match_type 1 or -1, the lookup_value is smaller or larger than + : the first value in sequence + : @error excel-err:Value if range_lookup=0 and the value cannot be found + : @example test/Queries/excel/lookup/match1.xq + :) +declare function excel:match( + $lookup_value as xs:anyAtomicType, + $sequence as xs:anyAtomicType+) as xs:anyAtomicType +{ + excel:match($lookup_value, $sequence, 1) +}; + +(:~ + : Returns a sub-array from an array. + : The inner array must be within the reference array + : + : @see http://office.microsoft.com/en-us/excel/HP052092081033.aspx + : @param $reference the reference array + : @param $reference_height the number of rows in the reference array + : @param $reference_width the number of elements in the reference array row + : @param $rows the relative row position where the sub-array starts. + : It must be a positive value, zero relative. + : @param $cols the relative column position where the sub-array starts. + : It must be a positive value, zero relative. + : @param $height the desired height of sub-array. + : The sub-array must be inside the reference array. + : @param $width the desired width of sub-array. + : The sub-array must be inside the reference array. + : @return The sequence specifying the sub-array, row after row + : @error excel-err:NA rows or cols are negative + : @error excel-err:NA height or width are smaller than 1 + : @error excel-err:Value reference array contains less elements than specified + : by reference_height and reference_width + : @error excel-err:NA the resulted sub-array is not completely contained inside reference array + : @example test/Queries/excel/lookup/offset3.xq + : @example test/Queries/excel/lookup/offset4.xq + :) +declare function excel:offset( + $reference as xs:anyAtomicType+, + $reference_height as xs:integer, + $reference_width as xs:integer, + $rows as xs:integer, + $cols as xs:integer, + $height as xs:integer, + $width as xs:integer) as xs:anyAtomicType* +{ + if ($rows lt 0 or $cols lt 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Offset function: rows and cols must be positive or zero ", $rows * 1000 + $cols) + else if ($height lt 1 or $width lt 1) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Offset function: height and width must be greater than zero", $height * 1000 + $width) + else if (($reference_height * $reference_width) gt fn:count($reference)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Offset function: reference width and height not specified correctly ", $reference_width * 1000 + $reference_height) + else if (($rows + $height) gt $reference_height or + ($cols + $width) gt $reference_width) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Offset function: inner array is outside the reference array") + else + for $i in (1 to $height) + return + for $j in (1 to $width) + return + $reference[($rows + $i - 1) * $reference_width + $cols + $j] +}; + +(:~ + : Same as above, only that the sub-array is specified only by rows and cols relative position. + : The sub-array height and width is computed to contain the remaining elements of the array. + : + : @see http://office.microsoft.com/en-us/excel/HP052092081033.aspx + : @param $reference the reference array + : @param $reference_height the number of rows in the reference array + : @param $reference_width the number of elements in the reference array row + : @param $rows the relative row position where the sub-array starts. + : It must be a positive value, zero relative. + : @param $cols the relative column position where the sub-array starts. + : It must be a positive value, zero relative. + : @return The sequence specifying the sub-array, row after row + : @error excel-err:NA rows or cols are negative + : @error excel-err:NA height or width are smaller than 1 + : @error excel-err:Value reference array contains less elements than specified + : by reference_height and reference_width + : @error excel-err:NA the resulted sub-array is not completely contained inside reference array + : @example test/Queries/excel/lookup/offset1.xq + : @example test/Queries/excel/lookup/offset2.xq + :) +declare function excel:offset( + $reference as xs:anyAtomicType+, + $reference_height as xs:integer, + $reference_width as xs:integer, + $rows as xs:integer, + $cols as xs:integer) as xs:anyAtomicType* +{ + excel:offset($reference, $reference_height, $reference_width, + $rows, $cols, + $reference_height - $rows, $reference_width - $cols) +}; + +(:~ + : Transposes an array. The rows become columns and vice versa. + : + : @see http://office.microsoft.com/en-us/excel/HP052093191033.aspx + : @param $array the sequence specifying the array, row after row + : @param $array_width the number of elements in a row + : @param $array_height the number of rows in the array + : @return The transposed array. It will be a sequence specifying an array, row after row. + : The result width is the input height. + : The result height is the input width. + : @error excel-err:Value the array contains less elements than specified by array_width and array_height + : @example test/Queries/excel/lookup/transpose1.xq + : @example test/Queries/excel/lookup/transpose2.xq + :) +declare function excel:transpose( + $array as xs:anyAtomicType+, + $array_width as xs:integer, + $array_height as xs:integer) as xs:anyAtomicType+ +{ + if (($array_height * $array_width) gt fn:count($array)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Transpose function: array width and height not specified correctly ", $array_width * 1000 + $array_height) + else + for $c in (1 to $array_width) + return + for $r in (1 to $array_height) + return + $array[($r - 1) * $array_width + $c] +}; + +(:~ + : Searches for a value in the first column of a table array + : and returns a value in the same row from another column in the table array. + : + :
Array is specified with 3 parameters: + :
table_array
is a sequence of elements, first row first, then second row and so on
+ :
table_width
specifies the number of elements in a row
+ :
table_height
specifies the number of rows
+ : + : For wildchar matching, the XQuery regex matcher is used. + : + : @see http://office.microsoft.com/en-us/excel/HP052093351033.aspx + : @param $lookup_value the value to be searched. + : Allowed types are numeric, string, boolean.

+ : Boolean values are compared only with booleans. + : Numbers are compared only with numbers, if range_lookup is not zero. + : The other types are converted to string and compared to string value of all values. + : @param $table_array the sequence of values, row after row + : @param $table_width the number of values in a row + : @param $table_height the number of rows + : @param $col_index_num the row index, 1 based + : @param $range_lookup

specified the algorithm to use: + :
true
find approximative match. + : First column of array must be sorted in ascending order.
+ :
false
find exact match, using xquery regex. + : First column of array can be in any order.
+ : @return The value found, with original type + : @error excel-err:Value if the array contains less elements than specified by table_height and table_width + : @error excel-err:Value if col_index_num is outside the range 1 .. table_height + : @error excel-err:Value if range_lookup is true and the value searched is smaller than + : the first value in the first column + : @error excel-err:Value if range_lookup=false and the value cannot be found + : @example test/Queries/excel/lookup/vlookup4.xq + :) +declare function excel:vlookup( + $lookup_value as xs:anyAtomicType, + $table_array as xs:anyAtomicType+, + $table_width as xs:integer, + $table_height as xs:integer, + $col_index_num as xs:integer, + $range_lookup as xs:boolean) as xs:anyAtomicType +{ + if ($table_height * $table_width gt fn:count($table_array)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Vlookup function: table array width and height not specified correctly ", $table_width * 1000 + $table_height) + else if ($col_index_num lt 1 or $col_index_num gt $table_width) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Vlookup function: col_index_num must be between 1 and table width ", $col_index_num) + else + let $table_header := ( + for $i in (1 to $table_height) + return + $table_array[($i - 1) * $table_width + 1] + ) + let $row := excel:lookup-column($lookup_value, $table_header, $range_lookup cast as xs:integer, 0, 0) + return + if ($row eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Vlookup function: lookup value cannot be matched", $lookup_value) + else if ($row gt $table_height) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Vlookup function: row found outside table array ", $row) + else + $table_array[($row - 1) * $table_width + $col_index_num] +}; + +(:~ + : Same as above, with range_lookup defaulted to true. + : It finds the largest value that is less than or equal to lookup_value. + : First column must be in ascending order. + : + : @see http://office.microsoft.com/en-us/excel/HP052093351033.aspx + : @param $lookup_value the value to be searched. + : Allowed types are numeric, string, boolean.

+ : Boolean values are compared only with booleans. + : Numbers are compared only with numbers, if range_lookup is not zero. + : The other types are converted to string and compared to string value of all values. + : @param $table_array the sequence of values, row after row + : @param $table_width the number of values in a row + : @param $table_height the number of rows + : @param $col_index_num the row index, 1 based + : @return The value found, with original type + : @error excel-err:Value if the array contains less elements than specified by table_height and table_width + : @error excel-err:Value if col_index_num is outside the range 1 .. table_height + : @error excel-err:Value if range_lookup is true and the value searched is smaller than + : the first value in the first column + : @error excel-err:Value if range_lookup=false and the value cannot be found + : @example test/Queries/excel/lookup/vlookup1.xq + : @example test/Queries/excel/lookup/vlookup2.xq + : @example test/Queries/excel/lookup/vlookup3.xq + : @example test/Queries/excel/lookup/vlookup5.xq + :) +declare function excel:vlookup( + $lookup_value as xs:anyAtomicType, + $table_array as xs:anyAtomicType+, + $table_width as xs:integer, + $table_height as xs:integer, + $col_index_num as xs:integer) as xs:anyAtomicType +{ + excel:vlookup($lookup_value, $table_array, $table_width, $table_height, + $col_index_num, fn:true()) +}; diff -Nru zorba-excel-module-2.9.1/src/math-sumproduct.xq zorba-excel-module-3.0.0/src/math-sumproduct.xq --- zorba-excel-module-2.9.1/src/math-sumproduct.xq 1970-01-01 00:00:00.000000000 +0000 +++ zorba-excel-module-3.0.0/src/math-sumproduct.xq 2013-11-07 17:11:01.000000000 +0000 @@ -0,0 +1,2802 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2009 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. +:) + +(:~ + : Module implementing the sumproduct functions from Excel 2003 math library. + : There are 30 functions defined, implementing the same function + : but with 1 to 30 parameters. + : Each parameter can be a sequence of infinite length. + : + : @see Excel 2003 Documentation: Math-sumproduct Functions + : + : @author Daniel Turcanu + : @project Zorba/Excel/Math Sumproduct + : + :) +module namespace excel = "http://zorba.io/modules/excel/math-sumproduct"; + +(:~ + : Import excel-math module functions. +:) +import module namespace excel-math = "http://zorba.io/modules/excel/math"; + +declare namespace excel-err = "http://zorba.io/modules/excel/errors"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + + +(:~ + : Sums the values in the sequence. + : The sequence can be of any length. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequence of numbers or arguments castable to numeric + : @return the sum + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/math/sumproduct1.xq +:) +declare function excel:sumproduct( $array1 as xs:anyAtomicType*) as xs:anyAtomicType + { + excel-math:sum( $array1 ) + }; + +(:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/math/sumproduct2.xq +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/math/sumproduct3.xq +:) +declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2)) + }; + + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @param $array21 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType*, + $array21 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20) or + fn:empty($array21)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) * + excel-math:cast-as-numeric($array21[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2), + fn:subsequence($array21,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @param $array21 the sequences of numbers or arguments castable to numeric + : @param $array22 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType*, + $array21 as xs:anyAtomicType*, + $array22 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20) or + fn:empty($array21) or + fn:empty($array22)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) * + excel-math:cast-as-numeric($array21[1]) * + excel-math:cast-as-numeric($array22[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2), + fn:subsequence($array21,2), + fn:subsequence($array22,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @param $array21 the sequences of numbers or arguments castable to numeric + : @param $array22 the sequences of numbers or arguments castable to numeric + : @param $array23 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType*, + $array21 as xs:anyAtomicType*, + $array22 as xs:anyAtomicType*, + $array23 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20) or + fn:empty($array21) or + fn:empty($array22) or + fn:empty($array23)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) * + excel-math:cast-as-numeric($array21[1]) * + excel-math:cast-as-numeric($array22[1]) * + excel-math:cast-as-numeric($array23[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2), + fn:subsequence($array21,2), + fn:subsequence($array22,2), + fn:subsequence($array23,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @param $array21 the sequences of numbers or arguments castable to numeric + : @param $array22 the sequences of numbers or arguments castable to numeric + : @param $array23 the sequences of numbers or arguments castable to numeric + : @param $array24 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType*, + $array21 as xs:anyAtomicType*, + $array22 as xs:anyAtomicType*, + $array23 as xs:anyAtomicType*, + $array24 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20) or + fn:empty($array21) or + fn:empty($array22) or + fn:empty($array23) or + fn:empty($array24)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) * + excel-math:cast-as-numeric($array21[1]) * + excel-math:cast-as-numeric($array22[1]) * + excel-math:cast-as-numeric($array23[1]) * + excel-math:cast-as-numeric($array24[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2), + fn:subsequence($array21,2), + fn:subsequence($array22,2), + fn:subsequence($array23,2), + fn:subsequence($array24,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @param $array21 the sequences of numbers or arguments castable to numeric + : @param $array22 the sequences of numbers or arguments castable to numeric + : @param $array23 the sequences of numbers or arguments castable to numeric + : @param $array24 the sequences of numbers or arguments castable to numeric + : @param $array25 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType*, + $array21 as xs:anyAtomicType*, + $array22 as xs:anyAtomicType*, + $array23 as xs:anyAtomicType*, + $array24 as xs:anyAtomicType*, + $array25 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20) or + fn:empty($array21) or + fn:empty($array22) or + fn:empty($array23) or + fn:empty($array24) or + fn:empty($array25)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) * + excel-math:cast-as-numeric($array21[1]) * + excel-math:cast-as-numeric($array22[1]) * + excel-math:cast-as-numeric($array23[1]) * + excel-math:cast-as-numeric($array24[1]) * + excel-math:cast-as-numeric($array25[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2), + fn:subsequence($array21,2), + fn:subsequence($array22,2), + fn:subsequence($array23,2), + fn:subsequence($array24,2), + fn:subsequence($array25,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @param $array21 the sequences of numbers or arguments castable to numeric + : @param $array22 the sequences of numbers or arguments castable to numeric + : @param $array23 the sequences of numbers or arguments castable to numeric + : @param $array24 the sequences of numbers or arguments castable to numeric + : @param $array25 the sequences of numbers or arguments castable to numeric + : @param $array26 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType*, + $array21 as xs:anyAtomicType*, + $array22 as xs:anyAtomicType*, + $array23 as xs:anyAtomicType*, + $array24 as xs:anyAtomicType*, + $array25 as xs:anyAtomicType*, + $array26 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20) or + fn:empty($array21) or + fn:empty($array22) or + fn:empty($array23) or + fn:empty($array24) or + fn:empty($array25) or + fn:empty($array26)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) * + excel-math:cast-as-numeric($array21[1]) * + excel-math:cast-as-numeric($array22[1]) * + excel-math:cast-as-numeric($array23[1]) * + excel-math:cast-as-numeric($array24[1]) * + excel-math:cast-as-numeric($array25[1]) * + excel-math:cast-as-numeric($array26[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2), + fn:subsequence($array21,2), + fn:subsequence($array22,2), + fn:subsequence($array23,2), + fn:subsequence($array24,2), + fn:subsequence($array25,2), + fn:subsequence($array26,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @param $array21 the sequences of numbers or arguments castable to numeric + : @param $array22 the sequences of numbers or arguments castable to numeric + : @param $array23 the sequences of numbers or arguments castable to numeric + : @param $array24 the sequences of numbers or arguments castable to numeric + : @param $array25 the sequences of numbers or arguments castable to numeric + : @param $array26 the sequences of numbers or arguments castable to numeric + : @param $array27 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType*, + $array21 as xs:anyAtomicType*, + $array22 as xs:anyAtomicType*, + $array23 as xs:anyAtomicType*, + $array24 as xs:anyAtomicType*, + $array25 as xs:anyAtomicType*, + $array26 as xs:anyAtomicType*, + $array27 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20) or + fn:empty($array21) or + fn:empty($array22) or + fn:empty($array23) or + fn:empty($array24) or + fn:empty($array25) or + fn:empty($array26) or + fn:empty($array27)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) * + excel-math:cast-as-numeric($array21[1]) * + excel-math:cast-as-numeric($array22[1]) * + excel-math:cast-as-numeric($array23[1]) * + excel-math:cast-as-numeric($array24[1]) * + excel-math:cast-as-numeric($array25[1]) * + excel-math:cast-as-numeric($array26[1]) * + excel-math:cast-as-numeric($array27[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2), + fn:subsequence($array21,2), + fn:subsequence($array22,2), + fn:subsequence($array23,2), + fn:subsequence($array24,2), + fn:subsequence($array25,2), + fn:subsequence($array26,2), + fn:subsequence($array27,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @param $array21 the sequences of numbers or arguments castable to numeric + : @param $array22 the sequences of numbers or arguments castable to numeric + : @param $array23 the sequences of numbers or arguments castable to numeric + : @param $array24 the sequences of numbers or arguments castable to numeric + : @param $array25 the sequences of numbers or arguments castable to numeric + : @param $array26 the sequences of numbers or arguments castable to numeric + : @param $array27 the sequences of numbers or arguments castable to numeric + : @param $array28 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType*, + $array21 as xs:anyAtomicType*, + $array22 as xs:anyAtomicType*, + $array23 as xs:anyAtomicType*, + $array24 as xs:anyAtomicType*, + $array25 as xs:anyAtomicType*, + $array26 as xs:anyAtomicType*, + $array27 as xs:anyAtomicType*, + $array28 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20) or + fn:empty($array21) or + fn:empty($array22) or + fn:empty($array23) or + fn:empty($array24) or + fn:empty($array25) or + fn:empty($array26) or + fn:empty($array27) or + fn:empty($array28)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) * + excel-math:cast-as-numeric($array21[1]) * + excel-math:cast-as-numeric($array22[1]) * + excel-math:cast-as-numeric($array23[1]) * + excel-math:cast-as-numeric($array24[1]) * + excel-math:cast-as-numeric($array25[1]) * + excel-math:cast-as-numeric($array26[1]) * + excel-math:cast-as-numeric($array27[1]) * + excel-math:cast-as-numeric($array28[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2), + fn:subsequence($array21,2), + fn:subsequence($array22,2), + fn:subsequence($array23,2), + fn:subsequence($array24,2), + fn:subsequence($array25,2), + fn:subsequence($array26,2), + fn:subsequence($array27,2), + fn:subsequence($array28,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @param $array21 the sequences of numbers or arguments castable to numeric + : @param $array22 the sequences of numbers or arguments castable to numeric + : @param $array23 the sequences of numbers or arguments castable to numeric + : @param $array24 the sequences of numbers or arguments castable to numeric + : @param $array25 the sequences of numbers or arguments castable to numeric + : @param $array26 the sequences of numbers or arguments castable to numeric + : @param $array27 the sequences of numbers or arguments castable to numeric + : @param $array28 the sequences of numbers or arguments castable to numeric + : @param $array29 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType*, + $array21 as xs:anyAtomicType*, + $array22 as xs:anyAtomicType*, + $array23 as xs:anyAtomicType*, + $array24 as xs:anyAtomicType*, + $array25 as xs:anyAtomicType*, + $array26 as xs:anyAtomicType*, + $array27 as xs:anyAtomicType*, + $array28 as xs:anyAtomicType*, + $array29 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20) or + fn:empty($array21) or + fn:empty($array22) or + fn:empty($array23) or + fn:empty($array24) or + fn:empty($array25) or + fn:empty($array26) or + fn:empty($array27) or + fn:empty($array28) or + fn:empty($array29)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) * + excel-math:cast-as-numeric($array21[1]) * + excel-math:cast-as-numeric($array22[1]) * + excel-math:cast-as-numeric($array23[1]) * + excel-math:cast-as-numeric($array24[1]) * + excel-math:cast-as-numeric($array25[1]) * + excel-math:cast-as-numeric($array26[1]) * + excel-math:cast-as-numeric($array27[1]) * + excel-math:cast-as-numeric($array28[1]) * + excel-math:cast-as-numeric($array29[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2), + fn:subsequence($array21,2), + fn:subsequence($array22,2), + fn:subsequence($array23,2), + fn:subsequence($array24,2), + fn:subsequence($array25,2), + fn:subsequence($array26,2), + fn:subsequence($array27,2), + fn:subsequence($array28,2), + fn:subsequence($array29,2)) + }; + + (:~ + : Multiplies the elements on the same position in each sequence + : and sums up the results. + : + : @see http://office.microsoft.com/en-us/excel/HP052092931033.aspx + : @param $array1 the sequences of numbers or arguments castable to numeric + : @param $array2 the sequences of numbers or arguments castable to numeric + : @param $array3 the sequences of numbers or arguments castable to numeric + : @param $array4 the sequences of numbers or arguments castable to numeric + : @param $array5 the sequences of numbers or arguments castable to numeric + : @param $array6 the sequences of numbers or arguments castable to numeric + : @param $array7 the sequences of numbers or arguments castable to numeric + : @param $array8 the sequences of numbers or arguments castable to numeric + : @param $array9 the sequences of numbers or arguments castable to numeric + : @param $array10 the sequences of numbers or arguments castable to numeric + : @param $array11 the sequences of numbers or arguments castable to numeric + : @param $array12 the sequences of numbers or arguments castable to numeric + : @param $array13 the sequences of numbers or arguments castable to numeric + : @param $array14 the sequences of numbers or arguments castable to numeric + : @param $array15 the sequences of numbers or arguments castable to numeric + : @param $array16 the sequences of numbers or arguments castable to numeric + : @param $array17 the sequences of numbers or arguments castable to numeric + : @param $array18 the sequences of numbers or arguments castable to numeric + : @param $array19 the sequences of numbers or arguments castable to numeric + : @param $array20 the sequences of numbers or arguments castable to numeric + : @param $array21 the sequences of numbers or arguments castable to numeric + : @param $array22 the sequences of numbers or arguments castable to numeric + : @param $array23 the sequences of numbers or arguments castable to numeric + : @param $array24 the sequences of numbers or arguments castable to numeric + : @param $array25 the sequences of numbers or arguments castable to numeric + : @param $array26 the sequences of numbers or arguments castable to numeric + : @param $array27 the sequences of numbers or arguments castable to numeric + : @param $array28 the sequences of numbers or arguments castable to numeric + : @param $array29 the sequences of numbers or arguments castable to numeric + : @param $array30 the sequences of numbers or arguments castable to numeric + : @return the sum of products + : @error excel-err:Value if the parameters cannot be casted to numeric type +:) + declare function excel:sumproduct( $array1 as xs:anyAtomicType*, + $array2 as xs:anyAtomicType*, + $array3 as xs:anyAtomicType*, + $array4 as xs:anyAtomicType*, + $array5 as xs:anyAtomicType*, + $array6 as xs:anyAtomicType*, + $array7 as xs:anyAtomicType*, + $array8 as xs:anyAtomicType*, + $array9 as xs:anyAtomicType*, + $array10 as xs:anyAtomicType*, + $array11 as xs:anyAtomicType*, + $array12 as xs:anyAtomicType*, + $array13 as xs:anyAtomicType*, + $array14 as xs:anyAtomicType*, + $array15 as xs:anyAtomicType*, + $array16 as xs:anyAtomicType*, + $array17 as xs:anyAtomicType*, + $array18 as xs:anyAtomicType*, + $array19 as xs:anyAtomicType*, + $array20 as xs:anyAtomicType*, + $array21 as xs:anyAtomicType*, + $array22 as xs:anyAtomicType*, + $array23 as xs:anyAtomicType*, + $array24 as xs:anyAtomicType*, + $array25 as xs:anyAtomicType*, + $array26 as xs:anyAtomicType*, + $array27 as xs:anyAtomicType*, + $array28 as xs:anyAtomicType*, + $array29 as xs:anyAtomicType*, + $array30 as xs:anyAtomicType* ) as xs:anyAtomicType + { + if( fn:empty($array1) or + fn:empty($array2) or + fn:empty($array3) or + fn:empty($array4) or + fn:empty($array5) or + fn:empty($array6) or + fn:empty($array7) or + fn:empty($array8) or + fn:empty($array9) or + fn:empty($array10) or + fn:empty($array11) or + fn:empty($array12) or + fn:empty($array13) or + fn:empty($array14) or + fn:empty($array15) or + fn:empty($array16) or + fn:empty($array17) or + fn:empty($array18) or + fn:empty($array19) or + fn:empty($array20) or + fn:empty($array21) or + fn:empty($array22) or + fn:empty($array23) or + fn:empty($array24) or + fn:empty($array25) or + fn:empty($array26) or + fn:empty($array27) or + fn:empty($array28) or + fn:empty($array29) or + fn:empty($array30)) + then + 0 + else + excel-math:cast-as-numeric($array1[1]) * + excel-math:cast-as-numeric($array2[1]) * + excel-math:cast-as-numeric($array3[1]) * + excel-math:cast-as-numeric($array4[1]) * + excel-math:cast-as-numeric($array5[1]) * + excel-math:cast-as-numeric($array6[1]) * + excel-math:cast-as-numeric($array7[1]) * + excel-math:cast-as-numeric($array8[1]) * + excel-math:cast-as-numeric($array9[1]) * + excel-math:cast-as-numeric($array10[1]) * + excel-math:cast-as-numeric($array11[1]) * + excel-math:cast-as-numeric($array12[1]) * + excel-math:cast-as-numeric($array13[1]) * + excel-math:cast-as-numeric($array14[1]) * + excel-math:cast-as-numeric($array15[1]) * + excel-math:cast-as-numeric($array16[1]) * + excel-math:cast-as-numeric($array17[1]) * + excel-math:cast-as-numeric($array18[1]) * + excel-math:cast-as-numeric($array19[1]) * + excel-math:cast-as-numeric($array20[1]) * + excel-math:cast-as-numeric($array21[1]) * + excel-math:cast-as-numeric($array22[1]) * + excel-math:cast-as-numeric($array23[1]) * + excel-math:cast-as-numeric($array24[1]) * + excel-math:cast-as-numeric($array25[1]) * + excel-math:cast-as-numeric($array26[1]) * + excel-math:cast-as-numeric($array27[1]) * + excel-math:cast-as-numeric($array28[1]) * + excel-math:cast-as-numeric($array29[1]) * + excel-math:cast-as-numeric($array30[1]) + + excel:sumproduct( fn:subsequence($array1,2), + fn:subsequence($array2,2), + fn:subsequence($array3,2), + fn:subsequence($array4,2), + fn:subsequence($array5,2), + fn:subsequence($array6,2), + fn:subsequence($array7,2), + fn:subsequence($array8,2), + fn:subsequence($array9,2), + fn:subsequence($array10,2), + fn:subsequence($array11,2), + fn:subsequence($array12,2), + fn:subsequence($array13,2), + fn:subsequence($array14,2), + fn:subsequence($array15,2), + fn:subsequence($array16,2), + fn:subsequence($array17,2), + fn:subsequence($array18,2), + fn:subsequence($array19,2), + fn:subsequence($array20,2), + fn:subsequence($array21,2), + fn:subsequence($array22,2), + fn:subsequence($array23,2), + fn:subsequence($array24,2), + fn:subsequence($array25,2), + fn:subsequence($array26,2), + fn:subsequence($array27,2), + fn:subsequence($array28,2), + fn:subsequence($array29,2), + fn:subsequence($array30,2)) + }; + +(:~ + : Returns the sum of the squares of the arguments. + : It used the sumproduct function. + : + : @see http://office.microsoft.com/en-us/excel/HP052092951033.aspx + : @param $numbers the sequence of one or more numbers or arguments castable to numeric + : @return the sum of squared values, as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/math/sumsq1.xq +:) + declare function excel:sumsq( $numbers as xs:anyAtomicType+) as xs:anyAtomicType + { + excel:sumproduct($numbers, $numbers) + }; + diff -Nru zorba-excel-module-2.9.1/src/math.xq zorba-excel-module-3.0.0/src/math.xq --- zorba-excel-module-2.9.1/src/math.xq 1970-01-01 00:00:00.000000000 +0000 +++ zorba-excel-module-3.0.0/src/math.xq 2013-11-07 17:11:01.000000000 +0000 @@ -0,0 +1,957 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2009 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. + :) + +(:~ + : This is a library module offering a part of the set of functions + : defined by Microsoft Excel 2003. + : + : @see Excel 2003 Documentation: Math Functions + : + : @author Daniel Turcanu + : @project Zorba/Excel/Math + : + :) +module namespace excel = "http://zorba.io/modules/excel/math" ; + +declare namespace excel-err = "http://zorba.io/modules/excel/errors"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + +(:~ + : Checks if the xs:anyAtomicType argument is actually a numeric type + : or can be converted to numeric. + : + : @param $value Parameter to be checked. + : @return true if the value can be casted to numeric. + :) +declare function excel:is-a-number($value as xs:anyAtomicType) as xs:boolean +{ + fn:string(fn:number($value)) ne 'NaN' +}; + +(:~ + : Cast the xs:anyAtomicType to a numeric type. + : If the value is already of a numeric type then nothing is changed. + : Otherwise the value is casted to the numeric type that is most appropriate. + : + : @param $number The parameter can be a number, string, boolean value. + : @return The casted value. + : @error excel-err:Value if the value cannot be casted to numeric type. + :) +declare function excel:cast-as-numeric($number as xs:anyAtomicType) as xs:anyAtomicType +{ + typeswitch ($number) + case xs:double return $number + case xs:decimal return $number + case xs:double return $number + case xs:float return $number + default return + if ($number castable as xs:integer) then + xs:integer($number) + else if ($number castable as xs:decimal) then + xs:decimal($number) + else if ($number castable as xs:double) then + xs:double($number) + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value is not a number", $number) +}; + +(: ---------------- Excel Math functions ----------------------- :) + +(:~ + : Compute the abs of a numeric value. + : The value can also be a string and it will be casted to the appropriate numeric first. + : + : @see http://office.microsoft.com/en-us/excel/HP052089781033.aspx + : @param $arg The parameter can be a number, string, boolean value. + : @return The abs value as a numeric type. + : @error excel-err:Value if arg cannot be casted to numeric type. + : @example test/Queries/excel/math/abs1.xq + : @example test/Queries/excel/math/abs2.xq + : @example test/Queries/excel/math/abs3.xq + : @example test/Queries/excel/math/abs4.xq + : @example test/Queries/excel/math/abs5.xq + : @example test/Queries/excel/math/abs6.xq + :) +declare function excel:abs($arg as xs:anyAtomicType) as xs:anyAtomicType +{ + fn:abs(excel:cast-as-numeric($arg)) +}; + +(:~ + : Returns number rounded up, away from zero, to the nearest multiple of significance. + : Significance must have the same sign as number. + : Number and significance must be of a numeric type or castable to numeric. + : Significance must not be zero. + : + : @see http://office.microsoft.com/en-us/excel/HP052090071033.aspx + : @param $number The value you want to round. + : @param $significance The multiple to which you want to round. + : @return The rounded value. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @error excel-err:Num if significance is zero or it doesn't have the same sign as number. + : @example test/Queries/excel/math/ceiling1.xq + : @example test/Queries/excel/math/ceiling2.xq + : @example test/Queries/excel/math/ceiling3.xq + : @example test/Queries/excel/math/ceiling4.xq + : @example test/Queries/excel/math/ceiling5.xq + : @example test/Queries/excel/math/ceiling6.xq + : @example test/Queries/excel/math/ceiling7.xq + :) +declare function excel:ceiling( + $number as xs:anyAtomicType, + $significance as xs:anyAtomicType) as xs:anyAtomicType +{ + let $num := excel:cast-as-numeric($number) + let $sig := excel:cast-as-numeric($significance) + return + if ($sig eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Ceiling function does not accept significance 0") + else if ($num * $sig ge 0) then + fn:ceiling($num div $sig) * $sig + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Ceiling function: both arguments must have the same sign") +}; + +(:~ + : Returns number rounded up to the nearest even integer. + : Regardless of the sign of number, a value is rounded up when adjusted away from zero. + : + : @see http://office.microsoft.com/en-us/excel/HP052090801033.aspx + : @param $number The value to round. + : @return The rounded value casted as numeric type. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @example test/Queries/excel/math/even1.xq + : @example test/Queries/excel/math/even2.xq + : @example test/Queries/excel/math/even3.xq + : @example test/Queries/excel/math/even4.xq + : @example test/Queries/excel/math/even5.xq + : @example test/Queries/excel/math/even6.xq + :) +declare function excel:even($number as xs:anyAtomicType) as xs:anyAtomicType +{ + let $num := excel:cast-as-numeric($number) + return + if ($num = 0) then + 0 + else + let $intnum := excel:ceiling($num, excel:sign($num)) + return + if ($intnum mod 2 ne 0) then + if ($intnum gt 0) then + $intnum + 1 + else + $intnum - 1 + else + $intnum +}; + +(:~ + : Function for computing factorial. + : This function should not be used outside this module. + : This recursive function computes: number * fact(number-1) + : + : @param $intnum A positive integer. + : @return The factorial of intnum. +:) +declare %private function excel:fact-integer($intnum as xs:integer) as xs:integer +{ + if ($intnum = 1) then + 1 + else + $intnum * excel:fact-integer($intnum - 1) +}; + +(:~ + : Returns the factorial of a number. + : + : @see http://office.microsoft.com/en-us/excel/HP052090841033.aspx + : @param $number The nonnegative number you want the factorial of. + : If number is not an integer, it is truncated. + : @return Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number. + : @error excel-err:Num if the number is smaller than zero + : @example test/Queries/excel/math/fact1.xq + : @example test/Queries/excel/math/fact2.xq + : @example test/Queries/excel/math/fact3.xq + : @example test/Queries/excel/math/fact4.xq + : @example test/Queries/excel/math/fact5.xq +:) +declare function excel:fact($number as xs:anyAtomicType) as xs:integer +{ + let $num := excel:cast-as-numeric($number) return + if ($num eq 0) then + 1 + else + if ($num lt 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Fact function does not accept numbers less than zero") + else + excel:fact-integer(xs:integer($num)) +}; + +(:~ + : Rounds number down, toward zero, to the nearest multiple of significance. + : Significance must have the same sign as number. + : + : @see http://office.microsoft.com/en-us/excel/HP052090941033.aspx + : @param $number The value you want to round. The value is casted to numeric. + : @param $significance The multiple to which you want to round. + : @return The rounded value as numeric type. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @error excel-err:Num if significance is zero or it doesn't have the same sign as number. + : @example test/Queries/excel/math/floor1.xq + : @example test/Queries/excel/math/floor2.xq + : @example test/Queries/excel/math/floor3.xq + : @example test/Queries/excel/math/floor4.xq + : @example test/Queries/excel/math/floor5.xq +:) +declare function excel:floor( + $number as xs:anyAtomicType, + $significance as xs:anyAtomicType) as xs:anyAtomicType +{ + let $num := excel:cast-as-numeric($number) + let $sig := excel:cast-as-numeric($significance) + return + if ($sig eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Floor function does not accept significance 0") + else if ($num * $sig ge 0) then + fn:floor($num div $sig) * $sig + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Floor function: both arguments must have the same sign") +}; + +(:~ + : Rounds a number down to the nearest integer. + : Positive numbers are rounded toward zero, negative numbers are rounded away from zero. + : + : @see http://office.microsoft.com/en-us/excel/HP052091421033.aspx + : @param $number The value to be rounded. + : @return The rounded integer. + : @error excel-err:Value if parameter cannot be casted to numeric type + : @example test/Queries/excel/math/int1.xq + : @example test/Queries/excel/math/int2.xq + : @example test/Queries/excel/math/int3.xq + : @example test/Queries/excel/math/int4.xq +:) +declare function excel:int($number as xs:anyAtomicType) as xs:integer +{ + xs:integer(fn:floor(excel:cast-as-numeric($number))) +}; + +(:~ + : Returns the remainder after number is divided by divisor. + : The result has the same sign as divisor. + : + : @see http://office.microsoft.com/en-us/excel/HP052091821033.aspx + : @param $number The number for which you want to find the remainder. + : @param $divisor The number by which you want to divide number. + : This cannot be zero. + : @return The remainder from division as numeric type. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @error excel-err:Div0 if divisor is zero after casting to numeric. + : @example test/Queries/excel/math/mod1.xq + : @example test/Queries/excel/math/mod2.xq + : @example test/Queries/excel/math/mod3.xq + : @example test/Queries/excel/math/mod4.xq + :) +declare function excel:mod( + $number as xs:anyAtomicType, + $divisor as xs:anyAtomicType) as xs:anyAtomicType +{ + let $num := excel:cast-as-numeric($number) + let $div := excel:cast-as-numeric($divisor) return + if ($div eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Div0"), "Mod operator: divide by 0") + else + let $result := $num mod $div + return + if ($result * $div lt 0) then + -$result + else + $result +}; + +(:~ + : Returns number rounded up to the nearest odd integer, away from zero. + : + : @see http://office.microsoft.com/en-us/excel/HP052092031033.aspx + : @param $number The value to round. + : @return The odd integer. + : @error excel-err:Value if parameter cannot be casted to numeric type. + : @example test/Queries/excel/math/odd1.xq + : @example test/Queries/excel/math/odd2.xq + : @example test/Queries/excel/math/odd3.xq + : @example test/Queries/excel/math/odd4.xq + : @example test/Queries/excel/math/odd5.xq + : @example test/Queries/excel/math/odd6.xq + :) +declare function excel:odd($number as xs:anyAtomicType) as xs:integer +{ + let $num := excel:cast-as-numeric($number) return + if ($num eq 0) then + 1 + else + let $intnum := excel:ceiling($num, excel:sign($num)) + return + if ($intnum mod 2 eq 0) then + if ($intnum ge 0) then + ($intnum + 1) cast as xs:integer + else + ($intnum - 1) cast as xs:integer + else + $intnum cast as xs:integer +}; + +(:~ + : Return the value of PI as decimal with 15 digits. + : + : @see http://office.microsoft.com/en-us/excel/HP052092141033.aspx + : @return The value of PI with 15 digits. + :) +declare function excel:pi() as xs:decimal +{ + 3.14159265358979 +}; + +(:~ + : Returns the result of a number raised to a power. + : The result is computed through successive multiplications. + : + : @see http://office.microsoft.com/en-us/excel/HP052092171033.aspx + : @param $number The base number. + : @param $power The exponent as integer (cannot be floating point like in Excel). + : @return The result as numeric type. + : @error excel-err:Value if parameter cannot be casted to numeric type. + : @error excel-err:Value if power is smaller than zero. + : @example test/Queries/excel/math/power1.xq + : @example test/Queries/excel/math/power3.xq + : @example test/Queries/excel/math/power4.xq + : @example test/Queries/excel/math/power5.xq + :) +declare function excel:power( + $number as xs:anyAtomicType, + $power as xs:integer) as xs:anyAtomicType +{ + let $num := excel:cast-as-numeric($number) + return + if ($power lt 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Power function: power must be greater or equal than zero") + else if ($power eq 0) then + 1 + else if ($power = 1) then + $num + else + let $retval := excel:power($num, $power idiv 2) + return + $retval * $retval * excel:power($num, $power mod 2) + }; + +(:~ + : Function for product. + : This function should not be used outside this module. + : Multiplies all numbers in the sequence. + : + : @param $numbers The list of arguments to be casted to numeric and multiplied. + : @return The multiplication result as numeric type. + : @error excel-err:Value if parameters cannot be casted to numeric type. + :) +declare %private function excel:product-internal($numbers as xs:anyAtomicType*) as xs:anyAtomicType +{ + if (fn:empty($numbers)) then + 1 + else + let $x := excel:cast-as-numeric($numbers[1]) + return + $x * excel:product-internal(fn:subsequence($numbers, 2)) +}; + +(:~ + : Multiplies all the numbers given as arguments and returns the product. + : + : @see http://office.microsoft.com/en-us/excel/HP052092231033.aspx + : @param $numbers The sequence of arguments convertable to numeric types. + : The sequence can be of any length. + : @return The multiplication result as numeric type. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @example test/Queries/excel/math/product1.xq + : @example test/Queries/excel/math/product2.xq + : @example test/Queries/excel/math/product3.xq + : @example test/Queries/excel/math/product4.xq + : @example test/Queries/excel/math/product5.xq + :) +declare function excel:product($numbers as xs:anyAtomicType*) as xs:anyAtomicType +{ + if (fn:empty($numbers)) then + 0 + else + excel:product-internal($numbers) +}; + +(:~ + : Returns the integer portion of a division. + : + : @see http://office.microsoft.com/en-us/excel/HP052092271033.aspx + : @param $numerator The divident. + : @param $denominator The divisor. It cannot be zero. + : @return The result value as numeric type. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @error excel-err:Div0 if denominator casted as numeric type has value zero. + : @example test/Queries/excel/math/quotient1.xq + : @example test/Queries/excel/math/quotient2.xq + : @example test/Queries/excel/math/quotient3.xq + : @example test/Queries/excel/math/quotient4.xq + :) +declare function excel:quotient( + $numerator as xs:anyAtomicType, + $denominator as xs:anyAtomicType) as xs:integer +{ + let $numer := excel:cast-as-numeric($numerator) + let $denom := excel:cast-as-numeric($denominator) + return + if ($denom eq 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Div0"), "Quotient function: divide by 0") + else + xs:integer($numer div $denom) +}; + +(:~ + : Rounds a number to a specified number of digits. + : If precision is greater than 0 (zero), then number is rounded + : to the specified number of decimal places. + : If num_digits is 0, then number is rounded to the nearest integer. + : If num_digits is less than 0, then number is rounded to the left of the decimal point. + : The 0.5 is rounded away from zero. + : + : @see http://office.microsoft.com/en-us/excel/HP052092391033.aspx + : @param $number The number to round, castable to a numeric type. + : @param $precision The number of decimal places to keep. + : @return The rounded number as numeric type. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @example test/Queries/excel/math/round1.xq + : @example test/Queries/excel/math/round2.xq + : @example test/Queries/excel/math/round3.xq + : @example test/Queries/excel/math/round4.xq + :) +declare function excel:round( + $number as xs:anyAtomicType, + $precision as xs:integer) as xs:anyAtomicType +{ + let $num := excel:cast-as-numeric($number) + return + if ($precision ge 0) then + let $exp_prec := excel:power(10, $precision) + return + if ($num ge 0) then + fn:floor($num * $exp_prec + 0.5) div $exp_prec + else + -fn:floor(-$num * $exp_prec + 0.5) div $exp_prec + else + let $exp_prec := excel:power(10, -$precision) + return + if ($num ge 0) then + fn:floor($num div $exp_prec + 0.5) * $exp_prec + else + -fn:floor(-$num div $exp_prec + 0.5) * $exp_prec +}; + +(:~ + : Rounds a number down, toward zero. + : If num_digits is greater than 0 (zero), then number is rounded down + : to the specified number of decimal places. + : If num_digits is 0, then number is rounded down to the nearest integer. + : If num_digits is less than 0, then number is rounded down to the left of the decimal point. + : + : @see http://office.microsoft.com/en-us/excel/HP052092411033.aspx + : @param $number The number to round, castable to numeric type. + : @param $precision The number of decimal places to keep. + : @return the truncated number toward zero, as numeric type. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @example test/Queries/excel/math/rounddown1.xq + : @example test/Queries/excel/math/rounddown2.xq + : @example test/Queries/excel/math/rounddown3.xq + : @example test/Queries/excel/math/rounddown4.xq + : @example test/Queries/excel/math/rounddown5.xq + :) +declare function excel:rounddown( + $number as xs:anyAtomicType, + $precision as xs:integer) as xs:anyAtomicType +{ + let $num := excel:cast-as-numeric($number) + return + if ($precision ge 0) then + let $exp_prec := excel:power(10, $precision) + return + if ($num ge 0) then + fn:floor($num * $exp_prec) div $exp_prec + else + -fn:floor(-$num * $exp_prec) div $exp_prec + else + let $exp_prec := excel:power(10, -$precision) + return + if ($num ge 0) then + fn:floor($num div $exp_prec) * $exp_prec + else + -fn:floor(-$num div $exp_prec) * $exp_prec +}; + +(:~ + : Rounds a number up, away from 0 (zero). + : If num_digits is greater than 0 (zero), then number is rounded down + : to the specified number of decimal places. + : If num_digits is 0, then number is rounded down to the nearest integer. + : If num_digits is less than 0, then number is rounded down to the left of the decimal point. + : + : @see http://office.microsoft.com/en-us/excel/HP052092421033.aspx + : @param $number The number to round, castable to numeric type. + : @param $precision The number of decimal places to keep. + : @return The truncated number away from zero, as numeric type. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @example test/Queries/excel/math/roundup1.xq + : @example test/Queries/excel/math/roundup2.xq + : @example test/Queries/excel/math/roundup3.xq + : @example test/Queries/excel/math/roundup4.xq + : @example test/Queries/excel/math/roundup5.xq + :) +declare function excel:roundup( + $number as xs:anyAtomicType, + $precision as xs:integer) as xs:anyAtomicType +{ + let $num := excel:cast-as-numeric($number) + return + if ($precision ge 0) then + let $exp_prec := excel:power(10, $precision) + return + if ($num ge 0) then + fn:ceiling($num * $exp_prec) div $exp_prec + else + -fn:ceiling(-$num * $exp_prec) div $exp_prec + else + let $exp_prec := excel:power(10, -$precision) + return + if ($num ge 0) then + fn:ceiling($num div $exp_prec) * $exp_prec + else + -fn:ceiling(-$num div $exp_prec) * $exp_prec +}; + +(:~ + : Determines the sign of a number. + : Returns 1 if the number is positive, zero (0) if the number is 0, + : and -1 if the number is negative. + : + : @see http://office.microsoft.com/en-us/excel/HP052092551033.aspx + : @param $number The argument castable to numeric type. + : @return The sign as (-1, 0, 1). + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @example test/Queries/excel/math/sign1.xq + : @example test/Queries/excel/math/sign2.xq + : @example test/Queries/excel/math/sign3.xq + :) +declare function excel:sign($number as xs:anyAtomicType) as xs:integer +{ + let $num := excel:cast-as-numeric($number) + return + if ($num eq 0) then + 0 + else if ($num gt 0) then + 1 + else + -1 + }; + +(:~ + : Adds all the numbers in the sequence. + : + : @see http://office.microsoft.com/en-us/excel/HP052092901033.aspx + : @param $numbers The sequence of arguments castable to numeric types. + : The sequence can be of any length. + : @return The sum as numeric type. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @example test/Queries/excel/math/sum1.xq + : @example test/Queries/excel/math/sum2.xq + : @example test/Queries/excel/math/sum3.xq + :) +declare function excel:sum($numbers as xs:anyAtomicType*) as xs:anyAtomicType +{ + if (fn:empty($numbers)) then + 0 + else + let $x := excel:cast-as-numeric($numbers[1]) + return + $x + excel:sum(fn:subsequence($numbers,2)) + }; + +(:~ + : Truncates a number to an integer by removing the fractional part of the number. + : + : @see http://office.microsoft.com/en-us/excel/HP052093241033.aspx + : @param $number The argument castable to numeric type. + : @return The integer value. + : @error excel-err:Value if parameter cannot be casted to numeric type. + : @example test/Queries/excel/math/trunc1.xq + : @example test/Queries/excel/math/trunc2.xq + :) +declare function excel:trunc($number as xs:anyAtomicType ) as xs:integer +{ + xs:integer(excel:cast-as-numeric($number)) +}; + +(:~ + : Truncates a number down to precision. + : This behaves exactly like rounddown. + : + : @see http://office.microsoft.com/en-us/excel/HP052093241033.aspx + : @param $number The argument castable to numeric type. + : @param $precision The number of decimal places to keep . + : @return The integer value. + : @error excel-err:Value if parameter cannot be casted to numeric type. + : @example test/Queries/excel/math/trunc3.xq + :) +declare function excel:trunc( + $number as xs:anyAtomicType, + $precision as xs:integer) as xs:anyAtomicType +{ + excel:rounddown(excel:cast-as-numeric($number), $precision) +}; + +(:~ + : Helper function.

+ : Sorts a sequence of numbers or arguments castable to numeric. + : It first casts all arguments to numeric and then sorts ascending. + : + : @param $numbers The sequence of arguments castable to numeric. + : @return The sorted sequence as numeric types. + : @error excel-err:Value if parameters cannot be casted to numeric type. + :) +declare function excel:sort-numbers($numbers as xs:anyAtomicType*) as xs:anyAtomicType* +{ + let $sorted-numbers := + ( + for $number in $numbers + let $num := excel:cast-as-numeric($number) + order by $num + return $num + ) + return $sorted-numbers +}; + +(:~ + : Converts radians into degrees. + : + : @see http://office.microsoft.com/en-us/excel/HP052090561033.aspx + : @param $radian The value in radians. + : @return The value in degrees 0 .. 360 or 0 .. -360. + :) +declare function excel:degrees($radian as xs:double) as xs:integer +{ + xs:integer(($radian * 180 div excel:pi()) mod 360) +}; + +(:~ + : Returns the double factorial of a number. + : Computes the double factorial of n as n(n-2)(n-4)... + : + : @see http://office.microsoft.com/en-us/excel/HP052090851033.aspx + : @param $number The positive integer value. + : @return The result as integer. + : @error excel-err:Num if the number is negative. + : @example test/Queries/excel/math/priority1/factdouble1.xq + : @example test/Queries/excel/math/priority1/factdouble2.xq + :) +declare function excel:factdouble($number as xs:integer) as xs:integer +{ + if ($number lt 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Factdouble function: number should be greater than zero or equal") + else if ($number eq 1) then + 1 + else if ($number eq 2) then + 2 + else + $number * excel:factdouble($number - 2) +}; + +(:~ + : Function for computing GCD. + : This function should not be used outside this module. + : It calculates the minimum value from a sequence of positive integers, + : not taking into account the zero value. + : + : @param $numbers The sequence of positive integers. + : @return The minimum value. If the sequence contains only zero values, then zero is returned. + :) +declare %private function excel:min-without-zero($numbers as xs:integer+) as xs:integer +{ + if (fn:count($numbers) eq 1) then + $numbers[1] + else + let $min-other := excel:min-without-zero(fn:subsequence($numbers, 2)) + return + if ($numbers[1] eq 0) then + $min-other + else if ($min-other eq 0) then + $numbers[1] + else if ($numbers[1] lt $min-other) then + $numbers[1] + else + $min-other +}; + +(:~ + : Function for computing GCD. + : This function should not be used outside this module. + : Checks if all integer numbers from a sequence divide exactly to a divident. + : + : @param $numbers The positive integers. + : @param $divident The divident to be tried. + : @return true if the numbers divide exactly. +:) +declare %private function excel:try-exact-divide( + $numbers as xs:integer*, + $divident as xs:integer) as xs:boolean +{ + if (fn:empty($numbers)) then + fn:true() + else + if ($numbers[1] mod $divident ne 0) then + fn:false() + else + excel:try-exact-divide(fn:subsequence($numbers, 2), $divident) +}; + +(:~ + : Function for computing GCD. + : This function should not be used outside this module. + : This function iterates through possible divisors and checks if the sequence + : divides exactly to any of those. It starts from the minimum value from the + : sequence and searches downwards. + : + : @param $numbers The sequence of positive integers. + : @param $min-nonzero The minimum value of numbers sequence, excluding the zero value. + : @param $iteration Which iteration is it. It starts from 1 and continues + : to min-nonzero/2. + : @return The greatest common divisor if found, or 1 if not found. + :) +declare %private function excel:iterate-all-gcd( + $numbers as xs:integer*, + $min-nonzero as xs:integer, + $iteration as xs:integer) as xs:integer +{ + if ($min-nonzero mod $iteration eq 0) then + if (excel:try-exact-divide($numbers, $min-nonzero idiv $iteration)) then + $min-nonzero idiv $iteration + else + excel:iterate-all-gcd($numbers, $min-nonzero, $iteration + 1) + else + if ($iteration > $min-nonzero idiv 2) then + 1 + else + excel:iterate-all-gcd($numbers, $min-nonzero, $iteration + 1) +}; + +(:~ + : Returns the greatest common divisor GCD of a sequence of integers. + : The sequence can have one or more positive integers. + : + : @see http://office.microsoft.com/en-us/excel/HP052091041033.aspx + : @param $numbers The sequence of positive integers. + : @return The GCD as integer. + : @error excel-err:Num if any number is smaller than zero. + : @example test/Queries/excel/math/priority1/gcd1.xq + : @example test/Queries/excel/math/priority1/gcd2.xq + : @example test/Queries/excel/math/priority1/gcd3.xq + : @example test/Queries/excel/math/priority1/gcd4.xq + : @example test/Queries/excel/math/priority1/gcd5.xq + : @example test/Queries/excel/math/priority1/gcd6.xq + : @example test/Queries/excel/math/priority1/gcd7.xq + : @example test/Queries/excel/math/priority1/gcd8.xq + :) +declare function excel:gcd($numbers as xs:integer+) as xs:integer +{ + if (fn:count($numbers) = 1) then + $numbers[1] + else + let $minval := excel:min-without-zero($numbers) + return + if ($minval lt 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "gcd function: numbers should be greater than zero or equal") + else if ($minval eq 0) then + 0 + else + excel:iterate-all-gcd($numbers, $minval, 1) +}; + +(:~ + : Returns the least common multiple of integers.

+ : LCM for two numbers is computed by multiplying them and dividing with GCD.

+ : The function is applied recursively replacing the first two numbers in the sequence with their LCM. + : + : @see http://office.microsoft.com/en-us/excel/HP052091521033.aspx + : @param $numbers The sequence of one or more positive integers. + : @return The LCM as integer. + : @error excel-err:Num if any number is smaller than zero. + : @example test/Queries/excel/math/priority1/lcm1.xq + : @example test/Queries/excel/math/priority1/lcm2.xq + : @example test/Queries/excel/math/priority1/lcm3.xq + : @example test/Queries/excel/math/priority1/lcm4.xq + : @example test/Queries/excel/math/priority1/lcm5.xq + :) +declare function excel:lcm($numbers as xs:integer+) as xs:integer +{ + if(count($numbers) eq 1) then + $numbers[1] + else + if(count($numbers) eq 2) then + let $product := excel:product(fn:distinct-values($numbers)) + return + if ($product eq 0) then + 0 + else + $product idiv excel:gcd($numbers) + else + excel:lcm((excel:lcm(($numbers[1], $numbers[2])), subsequence($numbers, 3))) + +}; + +(:~ + : Returns a number rounded to the desired multiple. + : MROUND rounds up, away from zero, if the remainder of dividing number by multiple + : is greater than or equal to half the value of multiple. + : MROUND is computed through floor function. + : + : @see http://office.microsoft.com/en-us/excel/HP052091851033.aspx + : @param $number The value to round, castable to numeric type. + : @param $multiple The multiple to which you want to round number. + : @return The rounded number up to the desired multiple. + : @error excel-err:Value if parameters cannot be casted to numeric type. + : @example test/Queries/excel/math/priority1/mround1.xq + : @example test/Queries/excel/math/priority1/mround2.xq + : @example test/Queries/excel/math/priority1/mround3.xq + :) +declare function excel:mround( + $number as xs:anyAtomicType, + $multiple as xs:anyAtomicType) as xs:anyAtomicType +{ + let $num := excel:cast-as-numeric($number) + let $mul := excel:cast-as-numeric($multiple) + let $floor := excel:floor($num, $mul) return + if ($num ge 0) then + if (($num - $floor) ge ($mul div 2)) then + $floor + $mul + else + $floor + else + if ((-$num + $floor) ge (-$mul div 2)) then + $floor + $mul + else + $floor +}; + +(:~ + : Converts degrees to radians. + : + : @see http://office.microsoft.com/en-us/excel/HP052092281033.aspx + : @param $degree An angle in degrees that you want to convert. + : @return The value in radians. + : @example test/Queries/excel/math/priority1/radians1.xq + : @example test/Queries/excel/math/priority1/radians2.xq + : @example test/Queries/excel/math/priority1/radians3.xq + :) +declare function excel:radians($degree as xs:integer) as xs:decimal +{ + ($degree mod 360) div 180.0 * excel:pi() +}; + +(:~ + : Converts an arabic numeral to roman, as text. + : Only the clasic format is supported (out of all formats Excel requires).

+ : M is the largest digit, it represents 1000. + : Numbers bigger than 2000 will be represented by a sequence of "M".

+ : D = 500, C = 100, L = 50, X = 10, V = 5, I = 1. + : + : @see http://office.microsoft.com/en-us/excel/HP052092381033.aspx + : @param $number A positive integer. + : @return The roman string representation. + : @error excel-err:Num if the input integer is negative + : @example test/Queries/excel/math/priority1/roman1.xq + : @example test/Queries/excel/math/priority1/roman2.xq + : @example test/Queries/excel/math/priority1/roman3.xq + :) +declare function excel:roman($number as xs:integer) as xs:string +{ + if ($number lt 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Roman function: number should be greater than zero or equal") + else if ($number ge 1000) then + fn:concat("M", excel:roman($number - 1000)) + else if ($number ge 900) then + fn:concat("CM", excel:roman($number - 900)) + else if ($number ge 800) then + fn:concat("DCCC", excel:roman($number - 800)) + else if ($number ge 700) then + fn:concat("DCC", excel:roman($number - 700)) + else if ($number ge 600) then + fn:concat("DC", excel:roman($number - 600)) + else if ($number ge 500) then + fn:concat("D", excel:roman($number - 500)) + else if ($number ge 400) then + fn:concat("CD", excel:roman($number - 400)) + else if ($number ge 300) then + fn:concat("CCC", excel:roman($number - 300)) + else if ($number ge 200) then + fn:concat("CC", excel:roman($number - 200)) + else if ($number ge 100) then + fn:concat("C", excel:roman($number - 100)) + else if ($number ge 90) then + fn:concat("XC", excel:roman($number - 90)) + else if ($number ge 80) then + fn:concat("LXXX", excel:roman($number - 80)) + else if ($number ge 70) then + fn:concat("LXX", excel:roman($number - 70)) + else if ($number ge 60) then + fn:concat("LX", excel:roman($number - 60)) + else if ($number ge 50) then + fn:concat("L", excel:roman($number - 50)) + else if ($number ge 40) then + fn:concat("XL", excel:roman($number - 40)) + else if ($number ge 30) then + fn:concat("XXX", excel:roman($number - 30)) + else if ($number ge 20) then + fn:concat("XX", excel:roman($number - 20)) + else if ($number ge 10) then + fn:concat("X", excel:roman($number - 10)) + else if ($number eq 9) then + "IX" + else if ($number eq 8) then + "VIII" + else if ($number eq 7) then + "VII" + else if ($number eq 6) then + "VI" + else if ($number eq 5) then + "V" + else if ($number eq 4) then + "IV" + else if ($number eq 3) then + "III" + else if ($number eq 2) then + "II" + else if ($number eq 1) then + "I" + else + "" +}; diff -Nru zorba-excel-module-2.9.1/src/statistical-zorba.xq zorba-excel-module-3.0.0/src/statistical-zorba.xq --- zorba-excel-module-2.9.1/src/statistical-zorba.xq 1970-01-01 00:00:00.000000000 +0000 +++ zorba-excel-module-3.0.0/src/statistical-zorba.xq 2013-11-07 17:11:01.000000000 +0000 @@ -0,0 +1,197 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2009 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. +:) + +(:~ + : This module implements some Excel 2003 statistical functions + : that cannot be implemented with standard XQuery functions. + : It uses Zorba specific functions. + : + : @Author Daniel Turcanu + : @See http://office.microsoft.com/en-us/excel/CH062528311033.aspx + : @project Zorba/Excel/Statistical Zorba +:) +module namespace excel = "http://zorba.io/modules/excel/statistical-zorba" ; + +import module namespace +excel-math="http://zorba.io/modules/excel/math"; + +import module namespace +excel-statistical="http://zorba.io/modules/excel/statistical"; + +declare namespace excel-err = "http://zorba.io/modules/excel/errors"; + +(:~ + : W3C Math namespace URI. +:) +declare namespace math="http://www.w3.org/2005/xpath-functions/math"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + + +(:~ + : Estimates standard deviation based on a sample. + : The standard deviation is a measure of how widely values are dispersed + : from the average value (the mean). + : It is computed with formula: + : sqrt( sum((x-average_x)^2) / (n-1) ) = sqrt ( VAR(numbers) ) + : + : @see http://office.microsoft.com/en-us/excel/HP052092771033.aspx + : @param $numbers the sequence of numbers or values castable to numeric + : The sequence can be of any length, from 1 up. + : @return the standard deviation, as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/stdev1.xq +:) +declare function excel:stdev($numbers as xs:anyAtomicType+) as xs:anyAtomicType +{ + math:sqrt(excel-statistical:var($numbers)) +}; + +(:~ + : Estimates standard deviation based on a sample. + : The standard deviation is a measure of how widely values are dispersed + : from the average value (the mean). + : It is computed with formula: + : sqrt( sum((x-average_x)^2) / (n-1) ) = sqrt ( VARA(numbers) ) + : + : @see http://office.microsoft.com/en-us/excel/HP052092791033.aspx + : @param $numbers the sequence of numbers or values castable to numeric + : The sequence can be of any length, from 1 up. + : @return the standard deviation, as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/stdeva1.xq +:) +declare function excel:stdeva($numbers as xs:anyAtomicType+) as xs:anyAtomicType +{ + math:sqrt(excel-statistical:vara($numbers)) +}; + +(:~ + : Calculates standard deviation based on the entire population given as arguments. + : The standard deviation is a measure of how widely values are dispersed from + : the average value (the mean). + : It is computed with formula: + : sqrt( sum((x-average_x)^2) / n ) = sqrt ( VARP(numbers) ) + : + : @see http://office.microsoft.com/en-us/excel/HP052092811033.aspx + : @param $numbers the sequence of numbers or values castable to numeric + : The sequence can be of any length, from 1 up. + : @return the standard deviation, as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/stdevp1.xq +:) +declare function excel:stdevp($numbers as xs:anyAtomicType+) as xs:anyAtomicType +{ + math:sqrt(excel-statistical:varp($numbers)) +}; + +(:~ + : Calculates standard deviation based on the entire population given as arguments. + : The standard deviation is a measure of how widely values are dispersed from + : the average value (the mean). + : It is computed with formula: + : sqrt( sum((x-average_x)^2) / n ) = sqrt ( VARPA(numbers) ) + : + : @see http://office.microsoft.com/en-us/excel/HP052092831033.aspx + : @param $numbers the sequence of numbers or values castable to numeric + : The sequence can be of any length, from 1 up. + : @return the standard deviation, as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/stdevpa1.xq +:) +declare function excel:stdevpa($numbers as xs:anyAtomicType+) as xs:anyAtomicType +{ + math:sqrt(excel-statistical:varpa($numbers)) +}; + +(:~ + : Moved from math module. + : Returns a subtotal in a sequence of numbers. + : The function applied is given by $function_num. + : + : @see http://office.microsoft.com/en-us/excel/HP052092881033.aspx + : @param $function_num

defines the function to be applied on sequence values. + : The possible values are: + :
1 or 101
AVERAGE
+ :
2 or 102
COUNT
+ :
3 or 103
COUNTA
+ :
4 or 104
MAX
+ :
5 or 105
MIN
+ :
6 or 106
PRODUCT
+ :
7 or 107
STDEV
+ :
8 or 108
STDEVP
+ :
9 or 109
SUM
+ :
10 or 110
VAR
+ :
11 or 111
VARP
+ : + : In this implementation there is no difference between x and 10x.

+ : @param $numbers the sequence of numbers or values castable to numeric. + : The sequence can be of any length. + : @return The function result, as numeric type + : @error depends on the function called + : @error excel-err:Num if $function_num is not a value between 1 .. 11 or 101 .. 111 + : @example test/Queries/excel/statistical/priority1/subtotal1.xq + : @example test/Queries/excel/statistical/priority1/subtotal2.xq + : @example test/Queries/excel/statistical/priority1/subtotal3.xq + : @example test/Queries/excel/statistical/priority1/subtotal4.xq + : @example test/Queries/excel/statistical/priority1/subtotal5.xq + : @example test/Queries/excel/statistical/priority1/subtotal6.xq + : @example test/Queries/excel/statistical/priority1/subtotal7.xq + : @example test/Queries/excel/statistical/priority1/subtotal8.xq + : @example test/Queries/excel/statistical/priority1/subtotal9.xq + : @example test/Queries/excel/statistical/priority1/subtotal10.xq + : @example test/Queries/excel/statistical/priority1/subtotal11.xq +:) +declare function excel:subtotal($function_num as xs:integer, $numbers as xs:anyAtomicType*) as xs:anyAtomicType +{ + if ($function_num = 1 or $function_num = 101) then + excel-statistical:average($numbers) + else + if ($function_num = 2 or $function_num = 102) then + excel-statistical:count($numbers) + else + if ($function_num = 3 or $function_num = 103) then + excel-statistical:counta($numbers) + else + if ($function_num = 4 or $function_num = 104) then + excel-statistical:max($numbers) + else + if ($function_num = 5 or $function_num = 105) then + excel-statistical:min($numbers) + else + if ($function_num = 6 or $function_num = 106) then + excel-math:product($numbers) + else + if ($function_num = 7 or $function_num = 107) then + excel:stdev($numbers) + else + if ($function_num = 8 or $function_num = 108) then + excel:stdevp($numbers) + else + if ($function_num = 9 or $function_num = 109) then + excel-math:sum($numbers) + else + if ($function_num = 10 or $function_num = 110) then + excel-statistical:var($numbers) + else + if ($function_num = 11 or $function_num = 111) then + excel-statistical:varp($numbers) + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Subtotal function: function_num should be between 1 and 11 or 101 and 111") +}; diff -Nru zorba-excel-module-2.9.1/src/statistical.xq zorba-excel-module-3.0.0/src/statistical.xq --- zorba-excel-module-2.9.1/src/statistical.xq 1970-01-01 00:00:00.000000000 +0000 +++ zorba-excel-module-3.0.0/src/statistical.xq 2013-11-07 17:11:01.000000000 +0000 @@ -0,0 +1,922 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2009 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. + :) + +(:~ + : This is a library module offering a part of the set of statistical functions + : defined by Microsoft Excel 2003. + : + : @see Excel 2003 Documentation: Statistical Functions + : + : @author Daniel Turcanu + : @project Zorba/Excel/Statistical + : + :) +module namespace excel = "http://zorba.io/modules/excel/statistical" ; + +(:~ + : Import excel-math module functions. + :) +import module namespace excel-math="http://zorba.io/modules/excel/math"; + +declare namespace excel-err = "http://zorba.io/modules/excel/errors"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + +(:~ + : Function for average function. + : This function should not be used outside this module. + : It counts all non-empty arguments from the sequence. + : The string value of every argument is used for checking. + : + : @param $numbers The sequence of values. + : @return The count of non-empty string values. + :) +declare %private function excel:count-non-empty($numbers as xs:anyAtomicType*) as xs:integer +{ + if (fn:empty($numbers)) then + 0 + else if (fn:string($numbers[1]) = "") then + excel:count-non-empty(fn:subsequence($numbers, 2)) + else + excel:count-non-empty(fn:subsequence($numbers, 2)) + 1 +}; + +(:~ + : Returns the average (arithmetic mean) of the arguments. + : Arguments can be empty values, otherwise must be castable to numeric. + : If sequence is empty then zero is returned. + : The sequence can be of any length. + : + : @see http://office.microsoft.com/en-us/excel/HP052089941033.aspx + : @param $numbers The sequence of numbers or empty values. + : @return The sum of all numbers divided by the number of non-empty values. + : @error excel-err:Value if the parameters cannot be casted to numeric type. + : @example test/Queries/excel/statistical/average1.xq + : @example test/Queries/excel/statistical/average2.xq + : @example test/Queries/excel/statistical/average3.xq + :) +declare function excel:average($numbers as xs:anyAtomicType*) as xs:anyAtomicType +{ + let $count := excel:count-non-empty($numbers) + return + if ($count gt 0) then + excel-math:sum((for $n in $numbers where fn:string($n) != "" return $n)) div $count + else + 0 +}; + +(:~ + : Counts the number of cells that contain numbers or values castable to numeric. + : + : @see http://office.microsoft.com/en-us/excel/HP052090261033.aspx + : @param $numbers The sequence of values, of any length. + : @return The count of numbers. + : @example test/Queries/excel/statistical/count1.xq + :) +declare function excel:count( $numbers as xs:anyAtomicType* ) as xs:integer +{ + if (fn:empty($numbers)) then + 0 + else + if (excel-math:is-a-number($numbers[1])) then + excel:count(fn:subsequence($numbers, 2)) + 1 + else + excel:count(fn:subsequence($numbers, 2)) +}; + +(:~ + : Counts the empty values in a sequence. + : The empty values are the ones with string value "". + : The value 0 is not counted. + : + : @see http://office.microsoft.com/en-us/excel/HP052090281033.aspx + : @param $cells the sequence of values, of any length + : @return The count + : @example test/Queries/excel/statistical/countblank1.xq +:) +declare function excel:countblank( $cells as xs:anyAtomicType* ) as xs:integer +{ + if (fn:empty($cells)) then + 0 + else + if (fn:string($cells[1]) = "") then + excel:countblank(fn:subsequence($cells, 2)) + 1 + else + excel:countblank(fn:subsequence($cells, 2)) +}; + +(:~ + : Returns the largest number in a sequence. + : + : @see http://office.microsoft.com/en-us/excel/HP052091701033.aspx + : @param $numbers the sequence of numbers or values castable to numeric. + : The sequence can be of any length. + : @return The max + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/max1.xq + : @example test/Queries/excel/statistical/max2.xq + : @example test/Queries/excel/statistical/max3.xq +:) +declare function excel:max ( $numbers as xs:anyAtomicType* ) as xs:anyAtomicType +{ + fn:max( + (for $n_at in $numbers + let $n := excel-math:cast-as-numeric($n_at) + return $n + ) + ) +}; + +(:~ + : Returns the smallest number in a sequence. + : + : @see http://office.microsoft.com/en-us/excel/HP052091761033.aspx + : @param $numbers the sequence of numbers or values castable to numeric. + : The sequence can be of any length. + : @return The min + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/min1.xq + : @example test/Queries/excel/statistical/min2.xq +:) +declare function excel:min ( $numbers as xs:anyAtomicType* ) as xs:anyAtomicType +{ + fn:min( + (for $n_at in $numbers + let $n := excel-math:cast-as-numeric($n_at) + return $n + ) + ) +}; + +(:~ + : Returns the median of the given numbers. + : The median is the number in the middle of a set of numbers. + : Half the numbers have values that are greater than the median, + : and half the numbers have values that are less than the median. + : + : + : @see http://office.microsoft.com/en-us/excel/HP052091741033.aspx + : @param $numbers the sequence of numbers, of any length + : @return for odd count of numbers return the number in the middle of the sorted sequence. + : For even count of numbers return the average of the two numbers in the middle. + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/median1.xq + : @example test/Queries/excel/statistical/median2.xq +:) +declare function excel:median( $numbers as xs:anyAtomicType* ) as xs:anyAtomicType +{ + let $number_count := excel:count( $numbers ) + let $sorted_numbers := excel-math:sort-numbers( $numbers ) return + if ($number_count mod 2 != 0) then + $sorted_numbers[$number_count idiv 2 + 1] + else + if ($number_count = 0) then + 0 + else + ($sorted_numbers[$number_count idiv 2] + $sorted_numbers[$number_count idiv 2 + 1] ) div 2 +}; + +(:~ + : Returns the most frequently occurring, or repetitive, value in a sequence. + : Arguments must be castable to numeric. + : + : @see http://office.microsoft.com/en-us/excel/HP052091831033.aspx + : @param $numbers the sequence of numbers, of any length + : @return The most occuring number + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @error fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA") if there are no duplicate numbers + : @example test/Queries/excel/statistical/mode1.xq + : @example test/Queries/excel/statistical/mode2.xq + : @example test/Queries/excel/statistical/mode3.xq +:) +declare function excel:mode( $numbers as xs:anyAtomicType* ) as xs:anyAtomicType +{ + if ( fn:empty($numbers)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Mode function: empty sequence") + else + let $result := + ( for $n_at in fn:distinct-values($numbers) + let $n := excel-math:cast-as-numeric($n_at) + let $count := fn:count( (for $d in $numbers where fn:string($d) = fn:string($n) return $d) ) + where $count > 1 + order by $count descending + return $n + ) return + if (fn:empty($result)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Mode function: no duplicate elements") + else + $result[1] +}; + +(:~ + : Returns the k-th percentile of values in a sequence. + : If k is not a multiple of 1/(n - 1), + : PERCENTILE interpolates to determine the value at the k-th percentile. + : The function is computed by (max-min)*k + min + : + : @see http://office.microsoft.com/en-us/excel/HP052092111033.aspx + : @param $numbers the sequence of numbers, of any length + : @param $k_at the percentile, with value between 0 .. 1 inclusive + : @return The computed percentile + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @error excel-err:Num if percentile is not between 0 .. 1 + : @example test/Queries/excel/statistical/percentile1.xq + : @example test/Queries/excel/statistical/percentile2.xq + : @example test/Queries/excel/statistical/percentile3.xq +:) +declare function excel:percentile( $numbers as xs:anyAtomicType*, $k_at as xs:anyAtomicType) as xs:anyAtomicType +{ + let $k := excel-math:cast-as-numeric($k_at) return + if ($k < 0 or $k > 1) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Percentile function: k must be a value between 0 and 1 inclusive") + else + let $max := excel:max($numbers) + let $min := excel:min($numbers) return + ($max - $min) * $k + $min +}; + + + +(:~ + : Function for AVEDEV. + : This function should not be used outside this module. + : Computes formula sum(abs(x - average)) for every x in $numbers + : + : @param $numbers The sequence of numbers or values castable to numeric. + : Sequence can be of any length. + : @param $average The average of all numbers, computed with function AVERAGE. + : @return The result of the formula. + : @error excel-err:Value if the parameters cannot be casted to numeric type. + :) +declare %private function excel:sum-deviations( + $numbers as xs:anyAtomicType*, + $average as xs:anyAtomicType) as xs:anyAtomicType +{ + if (fn:empty($numbers)) then + 0 + else + fn:abs(excel-math:cast-as-numeric($numbers[1]) - $average) + excel:sum-deviations(fn:subsequence($numbers, 2), $average) +}; + +(:~ + : Returns the average of the absolute deviations of data points from their mean. + : The formula is sum(abs(x - average_x))/n, where n is the count of x in the sequence. + : + : @see http://office.microsoft.com/en-us/excel/HP052089931033.aspx + : @param $numbers the sequence of numbers or values castable to numeric. + : Sequence can be of any length from 1 up. + : @return The formula result + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/priority1/avedev1.xq +:) +declare function excel:avedev($numbers as xs:anyAtomicType+) as xs:anyAtomicType +{ + let $average := excel:average($numbers) return + excel:sum-deviations($numbers, $average) div excel:count($numbers) +}; + +(:~ + : Function for AVERAGEA. + : This function should not be used outside this module. + : This function adds all values that are castable to numeric. + : + : @param $numbers A sequence of any values, any length. + : @return The sum of numbers. + :) +declare %private function excel:add-all-cells($numbers as xs:anyAtomicType*) as xs:anyAtomicType +{ + if (fn:empty($numbers)) then + 0 + else if (excel-math:is-a-number($numbers[1])) then + excel-math:cast-as-numeric($numbers[1]) + excel:add-all-cells(fn:subsequence($numbers, 2)) + else (: if (fn:string($numbers[1]) = "") then :) + excel:add-all-cells(fn:subsequence($numbers, 2)) +(: else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value is not a number or empty cell ", $numbers[1]) +:) +}; + +(:~ + : Calculates the average (arithmetic mean) of the values in the sequence of arguments. + : Arguments can be of any type. + : The numbers are added, and the sum is divided by the size of entire sequence. + : + : @see http://office.microsoft.com/en-us/excel/HP052089951033.aspx + : @param $numbers the sequence of values of any type. + : The sequence can be of any length, from 1 up. + : @return The result + : @example test/Queries/excel/statistical/priority1/averagea1.xq +:) +declare function excel:averagea($numbers as xs:anyAtomicType+) as xs:anyAtomicType +{ + excel:add-all-cells($numbers) div fn:count($numbers) +}; + +(:~ + : Counts the number of values that are not empty. + : Empty values are the one with string value "". + : + : @see http://office.microsoft.com/en-us/excel/HP052090271033.aspx + : @param $numbers the sequence of values of any type, any length + : @return The count of non-empty values + : @example test/Queries/excel/statistical/priority1/counta1.xq +:) +declare function excel:counta($numbers as xs:anyAtomicType*) as xs:integer +{ + if (fn:empty($numbers)) then + 0 + else + if (fn:string($numbers[1]) != "") then + 1 + excel:counta(fn:subsequence($numbers, 2)) + else + excel:counta(fn:subsequence($numbers, 2)) +}; + +(:~ + : Returns the k-th largest value in a data set. + : If n is the number of data points in a range, + : then LARGE(array,1) returns the largest value, + : and LARGE(array,n) returns the smallest value. + : + : @see http://office.microsoft.com/en-us/excel/HP052091511033.aspx + : @param $numbers the sequence of numbers or values castable to numeric. + : The sequence can be of any length, from 1 up. + : @param $k the position of largest value, with value from 1 to count of values + : @return The k-th largest value as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @error excel-err:Num if the sequence is empty + : @error excel-err:Num if k is not a value between 1 and the sequence size + : @example test/Queries/excel/statistical/priority1/large1.xq + : @example test/Queries/excel/statistical/priority1/large2.xq + : @example test/Queries/excel/statistical/priority1/large3.xq +:) +declare function excel:large($numbers as xs:anyAtomicType*, $k as xs:integer) as xs:anyAtomicType +{ + if (fn:empty($numbers)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Large function: value list must not be empty") + else if ($k > fn:count($numbers) or $k le 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Large function: k must be between 1 and the count of numbers ", $k) + else + let $ordered_numbers := + (for $n in $numbers + let $nn := excel-math:cast-as-numeric($n) + order by $nn descending + return $nn + ) return + $ordered_numbers[$k] +}; + +(:~ + : Returns the largest value in a list of arguments. + : In this implementation there is no difference between MAX and MAXA. + : + : @see http://office.microsoft.com/en-us/excel/HP052091711033.aspx + : @param $numbers the sequence of numbers or values castable to numeric + : The sequence can be of any length. + : @return The max + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/priority1/maxa1.xq +:) +declare function excel:maxa($numbers as xs:anyAtomicType*) as xs:anyAtomicType +{ + excel:max($numbers) +}; + +(:~ + : Returns the smallest value in a list of arguments. + : In this implementation there is no difference between MAX and MAXA. + : + : @see http://office.microsoft.com/en-us/excel/HP052091771033.aspx + : @param $numbers the sequence of numbers or values castable to numeric + : The sequence can be of any length. + : @return The min + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/priority1/mina1.xq +:) +declare function excel:mina($numbers as xs:anyAtomicType*) as xs:anyAtomicType +{ + excel:min($numbers) +}; + +(:~ + : Returns the rank of a number in a list of numbers. + : The rank of a number is its size relative to other values in a list. + : (If you were to sort the list, the rank of the number would be its position.) + : RANK gives duplicate numbers the same rank. + : + : @see http://office.microsoft.com/en-us/excel/HP052092311033.aspx + : @param $x The number whose rank you want to find. + : @param $numbers The sequence of numbers or values castable to numbers. + : The sequence can be of any length. + : @param $order_ascending

A boolean having the meaning: + :
false
then rank the number as if the sequence was sorted in descending order.
+ :
true
then rank the number as if the sequence was sorted in ascending order.
+ : @return The rank of $x. + : @error excel-err:Value if the parameters cannot be casted to numeric type. + : @example test/Queries/excel/statistical/priority1/rank1.xq + : @example test/Queries/excel/statistical/priority1/rank2.xq + : @example test/Queries/excel/statistical/priority1/rank4.xq + :) +declare function excel:rank( + $x as xs:anyAtomicType, + $numbers as xs:anyAtomicType*, + $order_ascending as xs:boolean) as xs:decimal +{ + let $ordered_numbers := + if ($order_ascending) then ( + for $n in $numbers + let $nn := excel-math:cast-as-numeric($n) + order by $nn ascending + return $nn + ) else ( + for $n in $numbers + let $nn := excel-math:cast-as-numeric($n) + order by $nn descending + return $nn + ) + let $xnum := excel-math:cast-as-numeric($x) + let $rank := + ( + for $i at $pos in $ordered_numbers + where $xnum = $i or $order_ascending and $xnum < $i + or fn:not($order_ascending) and $xnum > $i + return + if ($xnum = $i) then + $pos + else if ($pos = 1) then + 0 + else + ($pos - 1) + ($xnum - $ordered_numbers[$pos - 1]) div ($ordered_numbers[$pos] - $ordered_numbers[$pos - 1]) + ) + return + if (fn:empty($rank)) then + fn:count($numbers) + else + $rank[1] +}; + +(:~ + : This RANK function is same as the above, only that $order_ascending is set by default to false. + : + : @see http://office.microsoft.com/en-us/excel/HP052092311033.aspx + : @param $x The number whose rank you want to find. + : @param $numbers the sequence of numbers or values castable to numbers. + : The sequence can be of any length. + : @return The rank of $x. + : @error excel-err:Value if the parameters cannot be casted to numeric type. + : @example test/Queries/excel/statistical/priority1/rank3.xq + : @example test/Queries/excel/statistical/priority1/rank5.xq +:) +declare function excel:rank( + $x as xs:anyAtomicType, + $numbers as xs:anyAtomicType*) as xs:decimal +{ + excel:rank($x, $numbers, fn:false()) +}; + +(:~ + : Returns the rank of a value in a data set as a percentage of the data set. + : If x does not match one of the values in array, + : PERCENTRANK interpolates to return the correct percentage rank.

+ : The formula is uses: (RANK - 1) / (size - 1) . + : + : @see http://office.microsoft.com/en-us/excel/HP052092121033.aspx + : @param $numbers the sequence of numbers or values castable to numbers. + : The sequence can be of any length, from 1 up. + : @param $x is the value for which you want to know the rank + : @return The percentage of rank. + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @error excel-err:Num if the sequence is zero length + : @example test/Queries/excel/statistical/priority1/percentrank1.xq + : @example test/Queries/excel/statistical/priority1/percentrank2.xq + : @example test/Queries/excel/statistical/priority1/percentrank3.xq + : @example test/Queries/excel/statistical/priority1/percentrank4.xq + : @example test/Queries/excel/statistical/priority1/percentrank5.xq +:) +declare function excel:percentrank($numbers as xs:anyAtomicType*, $x as xs:anyAtomicType) as xs:decimal +{ + if (fn:empty($numbers)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Percentrank function: value list must not be empty") + else + let $rank := excel:rank($x, $numbers, fn:true()) return + if ($rank = 0) then + 0 + else + ($rank - 1) div (fn:count($numbers) - 1) +}; + +(:~ + : Returns the quartile of a data set. + : + : @see http://office.microsoft.com/en-us/excel/HP052092261033.aspx + : @param $numbers sequence of numbers or values castable to numbers. + : The sequence can be of any length, from 1 up. + : @param $quart

one of the values 0, 1, 2, 3, 4 with meaning: + :
0
compute minimum value
+ :
1
compute first quartile (25th percentile)
+ :
2
compute median value (50th percentile)
+ :
3
compute third quartile (75th percentile)
+ :
4
compute maximum value
+ : @return the computed quartile, as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @error excel-err:Num if the sequence is zero length + : @error excel-err:Num if $quart is not one of the values 0, 1, 2, 3, 4 + : @example test/Queries/excel/statistical/priority1/quartile1.xq + : @example test/Queries/excel/statistical/priority1/quartile2.xq + : @example test/Queries/excel/statistical/priority1/quartile3.xq + : @example test/Queries/excel/statistical/priority1/quartile4.xq + : @example test/Queries/excel/statistical/priority1/quartile5.xq +:) +declare function excel:quartile($numbers as xs:anyAtomicType*, $quart as xs:integer) as xs:anyAtomicType +{ + if (fn:empty($numbers)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Quartile function: value list must not be empty") + else + if ($quart = 0) then + excel:min($numbers) + else + if ($quart = 1) then + let $r := (fn:count($numbers) + 3) div 4 + let $rint := xs:integer($r) + let $rrem := $r - $rint + let $sorted_numbers := excel-math:sort-numbers( $numbers ) return + ($numbers[$rint + 1] - $numbers[$rint]) * $rrem + $numbers[$rint] + else + if ($quart = 2) then + excel:median($numbers) + else + if ($quart = 3) then + let $r := (3 * fn:count($numbers) + 1) div 4 + let $rint := xs:integer($r) + let $rrem := $r - $rint + let $sorted_numbers := excel-math:sort-numbers( $numbers ) return + ($numbers[$rint + 1] - $numbers[$rint]) * $rrem + $numbers[$rint] + else + if ($quart = 4) then + excel:max($numbers) + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Quartile function: quart should be between 0 and 4 :", $quart) +}; + +(:~ + : This function computes the k-th smallest value in a data set. + : Use this function to return values with a particular relative standing in a data set. + : If n is the number of data points in array, SMALL(array,1) equals the smallest value, + : and SMALL(array,n) equals the largest value. + : + : @see http://office.microsoft.com/en-us/excel/HP052092661033.aspx + : @param $numbers A sequence of numbers or values castable to numeric. + : The sequence can be of any length, from 1 up. + : @param $k The position (from the smallest) in the sequence of data to return. + : Must have value between 1 and size of sequence. + : @return The k-th smallest value of $numbers. + : @error excel-err:Value if the parameters cannot be casted to numeric type. + : @error excel-err:Num if the sequence is zero length. + : @error excel-err:Num if $k is not a value between 1 and the size of sequence. + : @example test/Queries/excel/statistical/priority1/small1.xq + : @example test/Queries/excel/statistical/priority1/small2.xq +:) +declare function excel:small($numbers as xs:anyAtomicType*, $k as xs:integer) as xs:anyAtomicType +{ + if (fn:empty($numbers)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Small function: value list must not be empty") + else if ($k gt fn:count($numbers) or $k le 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Small function: k must be between 1 and the count of numbers ", $k) + else + let $ordered_numbers := ( + for $n in $numbers + let $nn := excel-math:cast-as-numeric($n) + order by $nn ascending + return $nn + ) + return + $ordered_numbers[$k] +}; + + +(:~ + : Function for VAR, VARA, VARP, VARPA and SLOPE. + : This function should not be used outside this module. + : It computes formula sum((x - average_x)^2) for all x in $numbers. + : + : @param $numbers the sequence of numbers or values castable to numbers. + : The sequence can be of any length. + : @param $average The precomputed average over the sequence. + : @return The result as numeric type. + : @error excel-err:Value if the parameters cannot be casted to numeric type. + :) +declare %private function excel:sumsq-deviations($numbers as xs:anyAtomicType*, $average as xs:anyAtomicType) as xs:anyAtomicType +{ + if (fn:empty($numbers)) then + 0 + else + let $val := excel-math:cast-as-numeric($numbers[1]) - $average + return + $val * $val + excel:sumsq-deviations(fn:subsequence($numbers, 2), $average) +}; + +(:~ + : Estimates variance based on a sample.

+ : The formula is sum(x - average_x)^2 / (n - 1).

+ : average_x is computed with AVERAGE function.

+ : n is the count of numbers from the sequence, excluding empty values. + : + : @see http://office.microsoft.com/en-us/excel/HP052093301033.aspx + : @param $numbers the sequence of numbers or values castable to numeric. + : The sequence can be of any length, from 1 up. + : @return The variance, as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/priority1/var1.xq + :) +declare function excel:var($numbers as xs:anyAtomicType+) as xs:anyAtomicType +{ + let $average := excel:average($numbers) + return + excel:sumsq-deviations($numbers, $average) div (excel:count($numbers) - 1) +}; + +(:~ + : Estimates variance based on a sample.

+ : The formula is sum(x - average_x)^2 / (n - 1).

+ : average_x is computed with AVERAGE function.

+ : n is the size of sequence, including empty values.

+ : + : @see http://office.microsoft.com/en-us/excel/HP052093311033.aspx + : @param $numbers the sequence of numbers or values castable to numeric. + : The sequence can be of any length, from 1 up. + : @return The variance, as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/priority1/vara1.xq +:) +declare function excel:vara($numbers as xs:anyAtomicType+) as xs:anyAtomicType +{ + let $average := excel:average($numbers) return + excel:sumsq-deviations($numbers, $average) div (fn:count($numbers) - 1) +}; + +(:~ + : Calculates variance based on the entire population.

+ : The formula is sum(x - average_x)^2 / n.

+ : average_x is computed with AVERAGE function.

+ : n is the count of numbers from the sequence, excluding empty values.

+ : + : @see http://office.microsoft.com/en-us/excel/HP052093321033.aspx + : @param $numbers the sequence of numbers or values castable to numeric. + : The sequence can be of any length, from 1 up. + : @return The variance, as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/priority1/varp1.xq +:) +declare function excel:varp($numbers as xs:anyAtomicType+) as xs:anyAtomicType +{ + let $average := excel:average($numbers) return + excel:sumsq-deviations($numbers, $average) div excel:count($numbers) +}; + +(:~ + : Calculates variance based on the entire population.

+ : The formula is sum(x - average_x)^2 / n.

+ : average_x is computed with AVERAGE function.

+ : n is the size of sequence, including empty values.

+ : + : @see http://office.microsoft.com/en-us/excel/HP052093321033.aspx + : @param $numbers the sequence of numbers or values castable to numeric. + : The sequence can be of any length, from 1 up. + : @return The variance, as numeric type + : @error excel-err:Value if the parameters cannot be casted to numeric type + : @example test/Queries/excel/statistical/priority1/varpa1.xq +:) +declare function excel:varpa($numbers as xs:anyAtomicType+) as xs:anyAtomicType +{ + let $average := excel:average($numbers) return + excel:sumsq-deviations($numbers, $average) div fn:count($numbers) +}; + +(:~ + : Function for PROB function. + : This function should not be used outside this module. + : Computes the sum over a sequence of numbers. + : Checks if the values are between 0 and 1. + : + : @param $prob_range The sequence of probabilities. + : @return The sum of probabilities. This should be 1. + : @error excel-err:Num if any probability is not between 0 and 1. + : @error excel-err:Value if any parameter is not castable to numeric. +:) +declare %private function excel:sum-prob($prob_range as xs:anyAtomicType*) as xs:anyAtomicType +{ + if (fn:empty($prob_range)) then + 0 + else + let $prob_num := excel-math:cast-as-numeric($prob_range[1]) + return + if ($prob_num < 0 or $prob_num > 1) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Prob function: prob values should be between 0 and 1 ", $prob_num) + else + $prob_num + excel:sum-prob(fn:subsequence($prob_range, 2)) +}; + +(:~ + : Function for PROB function. + : This function should not be used outside this module. + : Checks the prob range and x range if they have the same number of values. + : Adds all probabilities corresponding to values between range_lower_limit and upper_limit. + : + : @param $x_range The sequence of x values. + : @param $prob_range The sequence of probabilies associated to x values. + : @param $range_lower_limit The lower limit of the range to compute the probability. + : @param $upper_limit The upper limit of the range to compute the probability. + : @return The sum of probabilities. + : @error excel-err:Value if any parameter is not castable to numeric. + : @error excel-err:Num if x_range and prob_range do not have the same number of values. + :) +declare %private function excel:sum-prob-x( + $x_range as xs:anyAtomicType*, + $prob_range as xs:anyAtomicType*, + $range_lower_limit as xs:anyAtomicType, + $upper_limit as xs:anyAtomicType) as xs:anyAtomicType +{ + if (fn:empty($x_range) and fn:not(fn:empty($prob_range))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Prob function: x range and prob range should have the same number of elements") + else if (fn:empty($prob_range) and fn:not(fn:empty($x_range))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Prob function: x range and prob range should have the same number of elements") + else if (fn:empty($prob_range) and fn:empty($x_range)) then + 0 + else + let $x := excel-math:cast-as-numeric($x_range[1]) + let $this_prob := + if ($x ge $range_lower_limit and $x le $upper_limit) then + excel-math:cast-as-numeric($prob_range[1]) + else + 0 + return + $this_prob + excel:sum-prob-x( + fn:subsequence($x_range, 2), + fn:subsequence($prob_range, 2), + $range_lower_limit, + $upper_limit) +}; + +(:~ + : Returns the probability that values in a range are between two limits. + : + : @see http://office.microsoft.com/en-us/excel/HP052092221033.aspx + : @param $x_range is the range of numeric values of x with which there are associated probabilities. + : This does not need to be ordered. + : @param $prob_range is a set of probabilities associated with values in x_range. + : @param $range_lower_limit is the lower bound on the value for which you want a probability. + : @param $upper_limit is the upper bound on the value for which you want a probability. + : @return The probability of the entire range + : @error excel-err:Num if any probability is not between 0 and 1 + : @error excel-err:Num if the sum of probabilities is not equal to 1 + : @error excel-err:Value if any parameter is not castable to numeric + : @error excel-err:Num if x_range and prob_range do not have the same number of values + : @example test/Queries/excel/statistical/priority2/prob2.xq +:) +declare function excel:prob($x_range as xs:anyAtomicType+, + $prob_range as xs:anyAtomicType+, + $range_lower_limit as xs:anyAtomicType, + $upper_limit as xs:anyAtomicType) as xs:anyAtomicType +{ + let $prob_sum := excel:sum-prob($prob_range) return + if ($prob_sum != 1) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Prob function: prob sum should equal 1") + else + excel:sum-prob-x($x_range, $prob_range, + excel-math:cast-as-numeric($range_lower_limit), + excel-math:cast-as-numeric($upper_limit)) +}; + +(:~ + : This is the same as above, only that upper_limit is not specified. + : The probability is computed only for range_lower_limit. + : + : @see http://office.microsoft.com/en-us/excel/HP052092221033.aspx + : @param $x_range is the range of numeric values of x with which there are associated probabilities. + : This does not need to be ordered. + : @param $prob_range is a set of probabilities associated with values in x_range. + : @param $range_lower_limit is the value for which you want a probability. + : @return The probability of the range_lower_limit value + : @error excel-err:Num if any probability is not between 0 and 1 + : @error excel-err:Num if the sum of probabilities is not equal to 1 + : @error excel-err:Value if any parameter is not castable to numeric + : @error excel-err:Num if x_range and prob_range do not have the same number of values + : @example test/Queries/excel/statistical/priority2/prob1.xq + :) +declare function excel:prob($x_range as xs:anyAtomicType+, + $prob_range as xs:anyAtomicType+, + $range_lower_limit as xs:anyAtomicType) as xs:anyAtomicType +{ + excel:prob($x_range, $prob_range, $range_lower_limit, $range_lower_limit) +}; + +(:~ + : Function for SLOPE function. + : This function should not be used outside this module. + : It computes the formula:

+ : sum((x - average_x)(y - average_y))

+ : where average_x and average_y are computed with AVERAGE function. + : + : @param $x_numbers The sequence of x numbers. + : @param $x_average The precomputed AVERAGE over the x_numbers. + : @param $y_numbers The sequence of y numbers. + : @param $y_average The precomputed AVERAGE over the y_numbers. + : @return The formula result, as numeric type. + : @error excel-err:Value if any parameter cannot be casted to numeric. + : @error fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA") if there are different numbers of x's and y's. + :) +declare %private function excel:sum-x-y-deviations( + $x_numbers as xs:anyAtomicType*, + $x_average as xs:anyAtomicType, + $y_numbers as xs:anyAtomicType*, + $y_average as xs:anyAtomicType) as xs:anyAtomicType +{ + if (fn:empty($x_numbers) and fn:not(fn:empty($y_numbers))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Slope function: different number of x's and y's") + else if (fn:empty($y_numbers) and fn:not(fn:empty($x_numbers))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Slope function: different number of x's and y's") + else if (fn:empty($x_numbers) and fn:empty($y_numbers)) then + 0 + else + (excel-math:cast-as-numeric($x_numbers[1]) - $x_average) * + (excel-math:cast-as-numeric($y_numbers[1]) - $y_average) + + excel:sum-x-y-deviations( + fn:subsequence($x_numbers, 2),$x_average, + fn:subsequence($y_numbers, 2),$y_average) +}; + +(:~ + : Returns the slope of the linear regression line through data points in known_y's and known_x's. + : The slope is the vertical distance divided by the horizontal distance between + : any two points on the line, which is the rate of change along the regression line. + : It computes the formula:

+ : sum((x - average_x)(y - average_y)) / sum((x - average_x)^2)

+ : where average_x and average_y are computed with AVERAGE function. + : + : @see http://office.microsoft.com/en-us/excel/HP052092641033.aspx + : @param $known_y the sequence of y numbers. + : The sequence can be of any length, from 1 up. + : @param $known_x the sequence of x numbers. + : The sequence can be of any length, from 1 up. + : @return The slope value, as numeric type + : @error excel-err:Value if any parameter cannot be casted to numeric + : @error fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA") if there are different numbers of x's and y's + : @error fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA") if any sequence is empty + : @error excel-err:Div0 if all x's are equal + : @example test/Queries/excel/statistical/priority2/slope1.xq +:) +declare function excel:slope($known_y as xs:anyAtomicType+, + $known_x as xs:anyAtomicType+) as xs:anyAtomicType +{ + if (fn:empty($known_y) or fn:empty($known_x)) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:NA"), "Slope function: known_x and known_y cannot be empty sequences") + else + let $x_average := excel:average($known_x) + let $y_average := excel:average($known_y) + let $xsq_dev := excel:sumsq-deviations($known_x, $x_average) return + if ($xsq_dev = 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Div0"), "Slope function: all x's are equal") + else + let $x_y_dev := excel:sum-x-y-deviations($known_x, $x_average, $known_y, $y_average) return + $x_y_dev div $xsq_dev +}; + +(:~ + : Returns a normalized value from a distribution characterized by mean and standard_dev.

+ : The formula is (x - mean) / standard_dev . + : + : @see http://office.microsoft.com/en-us/excel/HP052092731033.aspx + : @param $x is the value you want to normalize + : @param $mean is the arithmetic mean of the distribution. + : @param $standard_dev is the standard deviation of the distribution. + : @return The normalized x, as numeric type + : @error excel-err:Value if any parameter cannot be casted to numeric + : @error excel-err:Num if standard_dev is a value smaller than zero or equal + : @example test/Queries/excel/statistical/priority2/standardize1.xq +:) +declare function excel:standardize($x as xs:anyAtomicType, + $mean as xs:anyAtomicType, + $standard_dev as xs:anyAtomicType) as xs:double +{ + if ($standard_dev le 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Num"), "Standardize function: standard_dev must be positive ", $standard_dev) + else + (excel-math:cast-as-numeric($x) - excel-math:cast-as-numeric($mean)) div excel-math:cast-as-numeric($standard_dev) +}; diff -Nru zorba-excel-module-2.9.1/src/text.xq zorba-excel-module-3.0.0/src/text.xq --- zorba-excel-module-2.9.1/src/text.xq 1970-01-01 00:00:00.000000000 +0000 +++ zorba-excel-module-3.0.0/src/text.xq 2013-11-07 17:11:01.000000000 +0000 @@ -0,0 +1,767 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2009 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. +:) + +(:~ + : This is a library module offering the same set of functions + : defined by Microsoft Excel, under Text and Data Functions. + : + : @author Sorin Nasoi + : + : @see Excel Documentation: Text Functions + : + : @project Zorba/Excel/Text + :) +module namespace excel-text = "http://zorba.io/modules/excel/text" ; + +declare namespace excel-err = "http://zorba.io/modules/excel/errors"; + +(:~ + : Import excel-math module functions. + :) +import module namespace excel-math="http://zorba.io/modules/excel/math"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + +(:~ + : Returns the union of the values in two sequences in an implementation-defined order. It removes duplicates. + : + : @param $arg1 the first sequence. + : @param $arg2 the second sequence. + : @return The union of the values in two sequences in an implementation-defined order. It removes duplicates. + :) +declare %private function excel-text:value-union + ( $arg1 as xs:anyAtomicType* , + $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { + + fn:distinct-values(($arg1, $arg2)) + } ; + +(:~ + : Returns the intersection of the values in two sequences in an implementation-defined order. It removes duplicates. + : + : @param $arg1 the first sequence. + : @param $arg2 the second sequence. + : @return The intersection of the values in two sequences in an implementation-defined order. It removes duplicates. + :) +declare %private function excel-text:value-intersect + ( $arg1 as xs:anyAtomicType* , + $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { + + fn:distinct-values($arg1[.=$arg2]) + } ; + +(:~ + : Returns the values in one sequence that do not appear in the second sequence in an implementation-defined order. + : + : @param $arg1 the first sequence. + : @param $arg2 the second sequence. + : @return The values in one sequence that do not appear in the second sequence in an implementation-defined order. + :) +declare function excel-text:value-except + ( $arg1 as xs:anyAtomicType* , + $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { + + fn:distinct-values($arg1[not(.=$arg2)]) + } ; + +(:~ + : Reverses the order of characters in a string. + : + : @param $arg the string. + : @return Reverses the order of characters in a string or zero-length string if the argument is the empty sequence. + :) +declare %private function excel-text:reverse-string + ( $arg as xs:string? ) as xs:string { + + fn:codepoints-to-string(fn:reverse(fn:string-to-codepoints($arg))) + } ; + +(:~ + : Returns $string appended with enough repetitions of $padChar to make its length $length. + : + : @param $string the string. + : @param $padChar the character used for padding. + : @param $length the desired length. + : @return $string appended with enough repetitions of $padChar to make its length $length.

+ : The $string is trunctated if it's length is greater than $length. + :) +declare %private function excel-text:pad-string-to-length + ( $string as xs:string? , + $padChar as xs:string , + $length as xs:integer ) as xs:string { + + fn:substring(fn:string-join (($string, for $i in (1 to $length) return $padChar),'') + ,1,$length) + } ; + +(:~ + : Returns $toPad appended with enough repetitions of $padChar to make its length $length, the characters are added before the string. + : + : @param $toPad the value to be padded. + : @param $padChar the character used for padding. + : @param $length the desired length. + : @error excel-err:Value if the length of the $toPad is greater than the desired length. + : @return $toPad appended with enough repetitions of $padChar to make its length $length, the characters are added before the string. + :) +declare function excel-text:pad-integer-to-length + ( $toPad as xs:anyAtomicType?, + $padChar as xs:string , + $length as xs:integer) as xs:string { + + if ($length < fn:string-length(fn:string($toPad))) + then fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Number can not ne padded to the desired length", $length) + else + excel-text:reverse-string(excel-text:pad-string-to-length( + excel-text:reverse-string(fn:string($toPad)),fn:substring($padChar, 1, 1),$length)) +}; + +(:~ + : Returns an integer representing the first position of a substring that matches $pattern within $arg. + : + : @param $arg the string. + : @param $pattern the pattern to match. + : @return An integer representing the first position of a substring that matches $pattern within $arg.

+ : If $arg does not match $pattern, the empty sequence is returned. + :) +declare %private function excel-text:index-of-match-first + ( $arg as xs:string? , + $pattern as xs:string ) as xs:integer? { + + if (fn:matches($arg,$pattern)) + then fn:string-length(tokenize($arg, $pattern)[1]) + 1 + else () + } ; + +(:~ + : Returns an integer representing the first position of a substring that matches $pattern using $flags within $arg. + : + : @param $arg the string. + : @param $pattern the pattern to match. + : @param $flags options for the interpretation of the regular expression. + : @return An integer representing the first position of a substring that matches $pattern using $flags within $arg.

+ : If $arg does not match $pattern, the empty sequence is returned. + :) +declare %private function excel-text:index-of-match-first + ( $arg as xs:string? , + $pattern as xs:string, + $flags as xs:string ) as xs:integer? { + + if (matches($arg,$pattern,$flags)) + then fn:string-length(tokenize($arg, $pattern, $flags)[1]) + 1 + else () + } ; + +(:~ + : Returns an integer representing the $instance_num position of a substring that matches $pattern within $arg starting from $pos. + : + : @param $arg the string. + : @param $pattern the pattern to match. + : @param $pos the position to start the search. + : @param $instance_num the instance match number. + : @return An integer representing the $instance_num position of a substring that matches $pattern within $arg starting from $pos.

+ : If $arg does not match $pattern, the empty sequence is returned. + :) +declare %private function excel-text:index-of-match + ( $arg as xs:string? , + $pattern as xs:string, + $pos as xs:integer, + $instance_num as xs:integer) as xs:integer? { + + if($instance_num eq 1) + then $pos + excel-text:index-of-match-first(fn:substring($arg,$pos),$pattern) - 1 + else + let $index := excel-text:index-of-match-first(fn:substring($arg,$pos),$pattern) + return if(fn:not(fn:exists($index))) + then () + else excel-text:index-of-match($arg, $pattern, $pos + $index, ($instance_num - 1)) + } ; + +(:~ + : Splits $text in groups of $length characters starting from right to left. + : + : @param $text the string. + : @param $length the length of the group. + : @return Splits $text in groups of $length characters starting from right to left. + :) +declare %private function excel-text:tokenize-length + ($text as xs:string, + $length as xs:decimal) as xs:string* { + + if(fn:string-length($text) <= $length) then + $text + else + let $groupsNo := fn:string-length($text) idiv $length + let $tmp := fn:string-length($text) mod $length + return + if ($tmp eq 0) then + for $i in (1 to $groupsNo) + return fn:substring($text, (1 + ($length*($i - 1))), $length) + else + for $i in (0 to $groupsNo) + return + if ($i eq 0) then + fn:substring($text, 1, $tmp) + else + fn:substring($text, $tmp + ($length*($i - 1)) + 1, $length) +}; + +(:~ + : Returns the given $text unchanged. + : + : @see http://office.microsoft.com/en-us/excel/HP052508361033.aspx + : @param $text the time + : @return The given $text unchanged. + :) +declare function excel-text:asc + ( $text as xs:string) as xs:string { + + $text + } ; + +(:~ + : Returns the character specified by a certain codepoint. + : + : @see http://office.microsoft.com/en-us/excel/HP052090091033.aspx + : @param $number the codepoint. + : @error excel-err:Value provided $number must be in range [1,255]. + : @return the character specified by a certain codepoint. +Zorba uses UTF-8 encoding so the actual codepoint range is between [1,1114111] + :) + declare function excel-text:char + ( $number as xs:integer) as xs:string { + + if( (1 <= $number) and ($number <= 255)) then + fn:codepoints-to-string($number) + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided number must be in range [1,255]", $number) + } ; + +(:~ + : Returns a codepoint for the first character in a text string. + : + : @see http://office.microsoft.com/en-us/excel/HP052090151033.aspx + : @param $arg the string. + : @error excel-err:Value Provided $arg was empty. + : @return A codepoint for the first character in a text string. + :) +declare function excel-text:code + ( $arg as xs:string) as xs:integer { + + if( fn:string-length($arg) > 0 ) then + fn:string-to-codepoints(fn:substring($arg, 1, 1)) + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided text was empty",$arg) + } ; + +(:~ + : Joins two text strings into one text string. + : + : @see http://office.microsoft.com/en-us/excel/HP052090151033.aspx + : @param $arg1 the first string. + : @param $arg2 the second string. + : @return Joins two text strings into one text string. + :) +declare function excel-text:concatenate + ( $arg1 as xs:anyAtomicType?, + $arg2 as xs:anyAtomicType?) as xs:string { + + fn:concat($arg1,$arg2) + }; + +(:~ + : Joins several text strings into one text string. + : + : @see http://office.microsoft.com/en-us/excel/HP052090151033.aspx + : @param $args a sequence of strings. + : @return Joins several text strings into one text string. + :) +declare function excel-text:concatenate + ( $args as xs:anyAtomicType*) as xs:string { + + fn:string-join((for $value in $args return xs:string($value)), "") + } ; + +(:~ + : Removes all nonprintable characters from text. + : + : @see http://office.microsoft.com/en-us/excel/HP052090141033.aspx + : @param $arg the string. + : @return Removes all nonprintable characters from text. The CLEAN function was designed. + : to remove the first 32 nonprinting characters in the 7-bit ASCII code (values 0 through 31) from text.

+ : In the Unicode character set, there are additional nonprinting characters (values 127, 129, 141, 143, 144, and 157).

+ : By itself, the CLEAN function does not remove these additional nonprinting characters. + :) +declare function excel-text:clean + ( $arg as xs:string? ) as xs:string? { + + fn:codepoints-to-string( for $codepoint in fn:string-to-codepoints($arg) + return if ($codepoint < 32) then () else $codepoint) + } ; + +(:~ + : Rounds a number to the specified number of decimals, formats the number in + : decimal format using a period and commas, and returns the result as text. + : + : @see http://office.microsoft.com/en-us/excel/HP052090931033.aspx + : @param $number is the number you want to round and convert to text. + : @param $decimals is the number of digits to the right of the decimal point. + : @return Rounds a number to the specified number of decimals, formats the number in + : decimal format using a period and commas, and returns the result as text. + :) +declare function excel-text:fixed + ( $number as xs:decimal, + $decimals as xs:decimal) as xs:string { + + excel-text:fixed($number,$decimals,fn:false()) +}; + +(:~ + : Rounds a number to the specified number of decimals, formats the number in + :decimal format using a period and commas, and returns the result as text. + : + : @see http://office.microsoft.com/en-us/excel/HP052090931033.aspx + : @param $number is the number you want to round and convert to text. + : @param $decimals is the number of digits to the right of the decimal point. + : @param $no_commas is a logical value that, if TRUE, prevents FIXED from + :including commas in the returned text. + : @return Rounds a number to the specified number of decimals, formats the number in + :decimal format using a period and commas, and returns the result as text. + :) +declare function excel-text:fixed + ( $number as xs:decimal, + $decimals as xs:decimal, + $no_commas as xs:boolean) as xs:string { + + let $tmp := excel-math:round($number, $decimals) + + return if($no_commas) then + fn:string($tmp) + else + if(fn:contains(xs:string($tmp), '.')) then + let $x := fn:tokenize(xs:string($tmp),'[.]')[1] + let $y := fn:tokenize(xs:string($tmp),'[.]')[2] + let $x := fn:string-join(excel-text:tokenize-length($x,3), ',') + return fn:string-join(($x,$y),'.') + else + fn:string-join(excel-text:tokenize-length(fn:string($tmp),3), ',') + } ; + +(:~ + : Converts a number to text format and applies a currency symbol. The number of + :digits to the right of the decimal point is 2. + : + : @see http://office.microsoft.com/en-us/excel/HP052090931033.aspx + : @param $number is the number. + : @return Converts a number to text format and applies a currency symbol. The number of + :digits to the right of the decimal point is 2. + :) +declare function excel-text:dollar + ( $number as xs:decimal) as xs:string { + + excel-text:dollar($number, 2) + } ; + +(:~ + : Converts a number to text format and applies a currency symbol. + : + : @see http://office.microsoft.com/en-us/excel/HP052090931033.aspx + : @param $number is the number. + : @param $decimals is the number of digits to the right of the decimal point.

+ :If decimals is negative, number is rounded to the left of the decimal point. + : @return Converts a number to text format and applies a currency symbol. + :) +declare function excel-text:dollar + ( $number as xs:decimal, + $decimals as xs:decimal) as xs:string { + + let $int := fn:tokenize(fn:concat("$", excel-text:fixed(excel-math:abs($number), $decimals)),'\.')[1] + let $decimal := fn:tokenize(fn:concat("$", excel-text:fixed(excel-math:abs($number), $decimals)),'\.')[2] + + return if( fn:empty($decimal) ) then $int + else fn:concat($int,'.',excel-text:pad-string-to-length($decimal,"0",$decimals)) + } ; + +(:~ + : Compares two text strings and returns TRUE if they are exactly the same, + :FALSE otherwise. EXACT is case-sensitive but ignores formatting differences. + : + : @see http://office.microsoft.com/en-us/excel/HP052090811033.aspx + : @param $arg1 the first string. + : @param $arg2 the second string. + : @return Compares two text strings and returns TRUE if they are exactly the same, + :FALSE otherwise. EXACT is case-sensitive but ignores formatting differences. + :) +declare function excel-text:exact + ($arg1 as xs:string, + $arg2 as xs:string) as xs:boolean { + + $arg1 eq $arg2 +}; + +(:~ + : Returns the first character in a text string. + : + : @see http://office.microsoft.com/en-us/excel/HP052091531033.aspx + : @param $arg is the text string that contains the characters you want to extract. + : @return The first character in a text string. + :) +declare function excel-text:left + ( $arg as xs:string) as xs:string { + excel-text:left($arg, 1) + }; + +(:~ + : Returns the first character or characters in $text, based on the number of $num_chars you specify. + : + : @see http://office.microsoft.com/en-us/excel/HP052091531033.aspx + : @param $text is the text string that contains the characters you want to extract. + : @param $num_chars specifies the number of characters you want to extract. + : @return The first character or characters in $text, based on the number of $num_chars you specify. + :) +declare function excel-text:left + ( $text as xs:string, + $num_chars as xs:integer) as xs:string { + + let $chars := if (fn:string-length($text) < $num_chars) then + fn:string-length($text) + else + $num_chars + + return fn:substring($text, 1, $chars) + } ; + +(:~ + : Returns the number of characters in a text string. + : + : @see http://office.microsoft.com/en-us/excel/HP052091541033.aspx + : @param $arg the string. + : @return The number of characters in a text string. + :) +declare function excel-text:len + ( $arg as xs:string?) as xs:integer { + + fn:string-length($arg) + } ; + +(:~ + : Converts all uppercase letters in a text string to lowercase. + : + : @see http://office.microsoft.com/en-us/excel/HP052091671033.aspx + : @param $arg the string. + : @return Converts all uppercase letters in a text string to lowercase. + :) +declare function excel-text:lower + ( $arg as xs:string?) as xs:string? { + + fn:lower-case($arg) + } ; + +(:~ + : Returns a specific number of characters from a text string, starting at + :the position you specify, based on the number of characters you specify. + : + : @see http://office.microsoft.com/en-us/excel/HP052091751033.aspx + : @param $text the text string containing the characters you want to extract. + : @param $start_num the position of the first character you want to extract + : in text. The first character in text has start_num 1, and so on. + : @param $num_chars the number of characters you want to return from text. + : @return A specific number of characters from a text string, starting at + : the position you specify, based on the number of characters you specify. + :) +declare function excel-text:mid + ( $text as xs:string?, + $start_num as xs:integer, + $num_chars as xs:integer) as xs:string? { + let $len := fn:string-length($text) + return + if ($start_num > $len) then + xs:string('') + else if ($start_num < 1) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value is less than 1", $start_num) + else if ($num_chars < 0) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value is less than zero", $num_chars) + else + fn:substring($text, $start_num, $num_chars) + }; + +(:~ + : Replaces part of a text string, based on the number of characters you specify, with a different text string. + : + : @see http://office.microsoft.com/en-us/excel/HP052092351033.aspx + : @param $old_text is text in which you want to replace some characters. + : @param $start_num the position of the character in old_text that you want to replace with new_text. + : @param $num_chars the number of characters in old_text that you want REPLACE to replace with new_text. + : @param $new_text the text that will replace characters in old_text. + : @return Replaces part of a text string, based on the number of characters you specify, with a different text string. + :) +declare function excel-text:replace + ( $old_text as xs:string?, + $start_num as xs:integer, + $num_chars as xs:integer, + $new_text as xs:string) as xs:string { + + fn:concat(fn:substring($old_text,0,$start_num), + $new_text, + fn:substring($old_text,$start_num + $num_chars)) + }; + +(:~ + : Returns the last character in a text string. + : + : @see http://office.microsoft.com/en-us/excel/HP052092371033.aspx + : @param $arg the text string containing the characters you want to extract. + : @return The last character in a text string. + :) +declare function excel-text:right + ( $arg as xs:string) as xs:string { + + excel-text:right($arg, 1) + } ; + +(:~ + : Returns the last character or characters in a text string, based on the number of characters you specify. + : + : @see http://office.microsoft.com/en-us/excel/HP052092371033.aspx + : @param $text the text string containing the characters you want to extract. + : @param $num_chars specifies the number of characters you want RIGHT to extract. + : @return The last character or characters in a text string, based on the number of characters you specify. + :) +declare function excel-text:right + ( $text as xs:string, + $num_chars as xs:integer) as xs:string { + + let $chars := if (fn:string-length($text) < $num_chars) then fn:string-length($text) else $num_chars + return fn:substring($text, (fn:string-length($text) - $chars + 1), $chars) + }; + +(:~ + : Locate one text string within a second text string, and return the number of + : the starting position of the first text string from the first character of the + : second text string.

The search starts at position 1, and it is not case sensitive. + : + : @see http://office.microsoft.com/en-us/excel/HP052092491033.aspx + : @param $find_text text you want to find. + : @param $within_text text in which you want to search for $find_text. + : @error excel-err:Value the value is not greater than zero or is greater than the length of within_text. + : @error excel-err:Value value was not found. + : @return Locate one text string within a second text string, and return the number of + : the starting position of the first text string from the first character of the + : second text string.

The search starts at position 1, and it is not case sensitive. + :) +declare function excel-text:search + ( $find_text as xs:string, + $within_text as xs:string) as xs:integer? { + + excel-text:search($find_text, $within_text, 1) +}; + +(:~ + : Locate one text string within a second text string, and return the number of + : the starting position of the first text string from the first character of the + : second text string.

The search starts at $start_num, and it is not case sensitive. + : + : @see http://office.microsoft.com/en-us/excel/HP052092491033.aspx + : @param $find_text text you want to find. + : @param $within_text text in which you want to search for $find_text. + : @param $start_num the character number in within_text at which you want to start searching. + : @error excel-err:Value the value is not greater than zero or is greater than the length of within_text. + : @error excel-err:Value value was not found. + : @return Locate one text string within a second text string, and return the number of + : the starting position of the first text string from the first character of the + : second text string.

The search starts at $start_num, and it is not case sensitive. + :) +declare function excel-text:search + ( $find_text as xs:string, + $within_text as xs:string, + $start_num as xs:integer) as xs:integer? { + + if(($start_num < 1) or ($start_num > fn:string-length($within_text))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "The value is not greater than zero or is greater than the length of within_text", $start_num) + else + let $source := fn:substring($within_text, $start_num) + + return if(fn:exists(excel-text:index-of-match-first($source, $find_text, "i"))) then + $start_num + excel-text:index-of-match-first($source, $find_text, "i") -1 + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Value was not found", $find_text) +}; + +(:~ + : Locate one text string within a second text string, and return the number of the + : starting position of the first text string from the first character of the second text string.

+ : The search is case sensitive. + : + : @see http://office.microsoft.com/en-us/excel/HP052090891033.aspx + : @param $find_text text you want to find. + : @param $within_text text in which you want to search for $find_text. + : @error excel-err:Value the value is not greater than zero or is greater than the length of within_text. + : @error excel-err:Value value was not found. + : @return Locate one text string within a second text string, and return the number of the + : starting position of the first text string from the first character of the second text string.

+ : The search is case sensitive. + :) +declare function excel-text:find + ( $find_text as xs:string, + $within_text as xs:string) as xs:integer? { + + excel-text:find($find_text, $within_text, 1) +}; + +(:~ + : Locate one text string within a second text string, and return the number of the + : starting position of the first text string from the first character of the second text string.

+ : The search is case sensitive. + : + : @see http://office.microsoft.com/en-us/excel/HP052090891033.aspx + : @param $find_text text you want to find. + : @param $within_text text in which you want to search for $find_text. + : @param $start_num specifies the character at which to start the search. + : @error excel-err:Value the value is not greater than zero or is greater than the length of within_text. + : @error excel-err:Value value was not found. + : @return Locate one text string within a second text string, and return the number of the + : starting position of the first text string from the first character of the second text string.

+ : The search is case sensitive. + :) +declare function excel-text:find + ( $find_text as xs:string, + $within_text as xs:string, + $start_num as xs:integer) as xs:integer? { + + if(($start_num < 1) or ($start_num > fn:string-length($within_text))) then + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "The value is not greater than zero or is greater than the length of within_text", $start_num) + else + let $source := fn:substring($within_text, $start_num) + + return if(fn:exists(excel-text:index-of-match-first($source, $find_text))) then + $start_num + excel-text:index-of-match-first($source, $find_text) -1 + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Value was not found", $find_text) +}; + +(:~ + : Substitutes new_text for old_text in a text string. + : + : @see http://office.microsoft.com/en-us/excel/HP052092861033.aspx + : @param $text the text or the reference to a cell containing text for which you want to substitute characters. + : @param $old_text text you want to replace. + : @param $new_text text you want to replace old_text with. + : @param $instance_num specifies which occurrence of old_text you want to replace with new_text.

+ : Only that instance of old_text is replaced. + : @return Substitutes new_text for old_text in a text string.

Use SUBSTITUTE when you + : want to replace specific text in a text string; use REPLACE when you want + : to replace any text that occurs in a specific location in a text string. + :) +declare function excel-text:substitute + ( $text as xs:string, + $old_text as xs:string, + $new_text as xs:string, + $instance_num as xs:integer?) as xs:string { + + let $startPos := excel-text:index-of-match($text,$old_text,1,$instance_num) + return + if(fn:empty($startPos)) then $text + else excel-text:replace($text, $startPos, fn:string-length($old_text), $new_text) + } ; + +(:~ + : Substitutes new_text for old_text in a text string. Every occurrence of old_text in text is changed to new_text. + : + : @see http://office.microsoft.com/en-us/excel/HP052092861033.aspx + : @param $text the text or the reference to a cell containing text for which you want to substitute characters. + : @param $old_text text you want to replace. + : @param $new_text text you want to replace old_text with. + : @return Substitutes new_text for old_text in a text string. Every occurrence of old_text in text is changed to new_text. + :) +declare function excel-text:substitute + ( $text as xs:string, + $old_text as xs:string, + $new_text as xs:string) as xs:string? { + + fn:replace($text, $old_text, $new_text) + } ; + +(:~ + : Removes all spaces from text except for single spaces between words. + : + : @see http://office.microsoft.com/en-us/excel/HP052093211033.aspx?pid=CH062528321033 + : @param $text from which you want spaces removed. + : @return Removes all spaces from text except for single spaces between words. + :) +declare function excel-text:trim + ( $text as xs:string?) as xs:string? { + + fn:normalize-space($text) + } ; + +(:~ + : Converts text to uppercase. + : + : @see http://office.microsoft.com/en-us/excel/HP052093271033.aspx + : @param $text text you want converted to uppercase. + : @return Converts text to uppercase. + :) +declare function excel-text:upper + ( $text as xs:string?) as xs:string? { + + fn:upper-case($text) + }; + +(:~ + : Converts the $value to string. + : + : @see http://office.microsoft.com/en-us/excel/HP052093041033.aspx + : @param $value the value + : @return Converts the $value to string. + :) +declare function excel-text:t +( $value as xs:anyAtomicType?) as xs:string { + + if( $value instance of xs:string ) then fn:string($value) + else fn:string("") + } ; + +(:~ + : Converts a text string that represents a number to a number. + : + : @see http://office.microsoft.com/en-us/excel/HP052093291033.aspx + : @param $arg the value. + : @error excel-err:Value provided value is not a number. + : @return Converts a text string that represents a number to a number. + :) +declare function excel-text:value +( $arg as xs:anyAtomicType?) as xs:anyAtomicType? { + + typeswitch($arg) + case xs:double return $arg + case xs:decimal return $arg + case xs:double return $arg + case xs:float return $arg + default return + if($arg castable as xs:integer) then + xs:integer($arg) + else + if($arg castable as xs:decimal) then + xs:decimal($arg) + else + if($arg castable as xs:double) then + xs:double($arg) + else + fn:error(fn:QName("http://zorba.io/modules/excel/errors", "excel-err:Value"), "Provided value is not a number", $arg) +}; diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/date/excel_date1.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/date/excel_date1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/date/excel_date1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/date/excel_date1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:date(1999,12,31) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/date/excel_date2.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/date/excel_date2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/date/excel_date2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/date/excel_date2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:date(1999,1,31) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/day/excel_day1.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/day/excel_day1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/day/excel_day1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/day/excel_day1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; -excel-datetime:day(xs:date("1999-05-31-05:00")) \ No newline at end of file +excel-datetime:day(xs:date("1999-05-31-05:00")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3601.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3601.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3601.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3601.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; -excel-datetime:days360(xs:date("2008-01-05"), xs:date("2008-03-31"), fn:false()) \ No newline at end of file +excel-datetime:days360(xs:date("2008-01-05"), xs:date("2008-03-31"), fn:false()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3602.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3602.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3602.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3602.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; -excel-datetime:days360(xs:date("2008-01-05"), xs:date("2008-03-31"), fn:true()) \ No newline at end of file +excel-datetime:days360(xs:date("2008-01-05"), xs:date("2008-03-31"), fn:true()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3603.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3603.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3603.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3603.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; -excel-datetime:days360(xs:date("2008-05-03"), xs:date("2008-03-31"), fn:false()) \ No newline at end of file +excel-datetime:days360(xs:date("2008-05-03"), xs:date("2008-03-31"), fn:false()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3604.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3604.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3604.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3604.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; -excel-datetime:days360(xs:date("2008-05-03"), xs:date("2008-03-31"), fn:true()) \ No newline at end of file +excel-datetime:days360(xs:date("2008-05-03"), xs:date("2008-03-31"), fn:true()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3605.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3605.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3605.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3605.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; -excel-datetime:days360(xs:date("2008-01-05"), xs:date("2008-03-31")) \ No newline at end of file +excel-datetime:days360(xs:date("2008-01-05"), xs:date("2008-03-31")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3606.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3606.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/days360/excel_days3606.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/days360/excel_days3606.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; -excel-datetime:days360(xs:date("2008-05-03"), xs:date("2008-03-31")) \ No newline at end of file +excel-datetime:days360(xs:date("2008-05-03"), xs:date("2008-03-31")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/hour/excel_hour1.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/hour/excel_hour1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/hour/excel_hour1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/hour/excel_hour1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:hour(xs:time("03:30:30.300")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/hour/excel_hour2.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/hour/excel_hour2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/hour/excel_hour2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/hour/excel_hour2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:hour(xs:time("15:30:30")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/hour/excel_hour3.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/hour/excel_hour3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/hour/excel_hour3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/hour/excel_hour3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:hour(xs:time("15:30:00")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/minute/excel_minute1.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/minute/excel_minute1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/minute/excel_minute1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/minute/excel_minute1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:minute(xs:time("16:48:00")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/month/excel_month1.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/month/excel_month1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/month/excel_month1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/month/excel_month1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:month(xs:date("1999-05-31-05:00")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/networkdays/excel_networkdays1.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/networkdays/excel_networkdays1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/networkdays/excel_networkdays1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/networkdays/excel_networkdays1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:networkdays(xs:date("2008-10-01"), xs:date("2009-03-01")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/networkdays/excel_networkdays2.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/networkdays/excel_networkdays2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/networkdays/excel_networkdays2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/networkdays/excel_networkdays2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:networkdays(xs:date("2008-10-01"), xs:date("2009-03-01"),()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/networkdays/excel_networkdays3.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/networkdays/excel_networkdays3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/networkdays/excel_networkdays3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/networkdays/excel_networkdays3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:networkdays(xs:date("2008-10-01"), xs:date("2009-03-01"), (xs:date("2008-11-26"),xs:date("2008-12-04"),xs:date("2009-01-21"))) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/second/excel_second1.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/second/excel_second1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/second/excel_second1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/second/excel_second1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:second(xs:time("13:20:10.5")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/time/excel_time1.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/time/excel_time1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/time/excel_time1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/time/excel_time1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; -excel-datetime:time(23,0,0) \ No newline at end of file +excel-datetime:time(23,0,0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/time/excel_time2.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/time/excel_time2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/time/excel_time2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/time/excel_time2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:time(23,4,3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday1.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:weekday(xs:date("2008-02-14")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday2.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:weekday(xs:date("2008-02-14"),2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday3.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:weekday(xs:date("2008-02-14"),3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday4.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:weekday(xs:date("2008-02-10")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday5.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:weekday(xs:date("2008-02-10"),2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday6.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:weekday(xs:date("2008-02-10"),3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday7.spec zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday7.spec --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday7.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday7.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday7.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday7.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/weekday/excel_weekday7.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/weekday/excel_weekday7.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:weekday(xs:date("2008-02-14"),4) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/datetime/year/excel_year1.xq zorba-excel-module-3.0.0/test/Queries/excel/datetime/year/excel_year1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/datetime/year/excel_year1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/datetime/year/excel_year1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime"; +excel-datetime = "http://zorba.io/modules/excel/datetime"; excel-datetime:year(xs:date("1999-05-31")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:bin2dec("1100100") \ No newline at end of file +excel-engineering:bin2dec("1100100") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:bin2dec("1111111111") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec3.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec3.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec3.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec3.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec3.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:bin2dec("11111111110") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec4.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec4.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec4.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec4.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec4.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2dec/excel_bin2dec4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2dec/excel_bin2dec4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:bin2dec("2111111111") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2hex/excel_bin2hex1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2hex/excel_bin2hex1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2hex/excel_bin2hex1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2hex/excel_bin2hex1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:bin2hex(11111011, 4) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2hex/excel_bin2hex2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2hex/excel_bin2hex2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2hex/excel_bin2hex2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2hex/excel_bin2hex2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:bin2hex(1110) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2hex/excel_bin2hex3.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2hex/excel_bin2hex3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2hex/excel_bin2hex3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2hex/excel_bin2hex3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:bin2hex(1111111111) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2oct/excel_bin2oct1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2oct/excel_bin2oct1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2oct/excel_bin2oct1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2oct/excel_bin2oct1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:bin2oct(1001,3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2oct/excel_bin2oct2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2oct/excel_bin2oct2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2oct/excel_bin2oct2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2oct/excel_bin2oct2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:bin2oct(1100100) \ No newline at end of file +excel-engineering:bin2oct(1100100) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2oct/excel_bin2oct3.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2oct/excel_bin2oct3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/bin2oct/excel_bin2oct3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/bin2oct/excel_bin2oct3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:bin2oct(1111111111) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin(xs:integer(100)) \ No newline at end of file +excel-engineering:dec2bin(xs:integer(100)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin10.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin10.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin10.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin10.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin10.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin10.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin10.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin10.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin(511, 0) \ No newline at end of file +excel-engineering:dec2bin(511, 0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin11.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin11.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin11.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin11.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin11.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin11.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin11.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin11.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin(511, -1) \ No newline at end of file +excel-engineering:dec2bin(511, -1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin(-1) \ No newline at end of file +excel-engineering:dec2bin(-1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin3.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin(xs:integer(100),8) \ No newline at end of file +excel-engineering:dec2bin(xs:integer(100),8) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin4.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin(xs:integer(-1),7) \ No newline at end of file +excel-engineering:dec2bin(xs:integer(-1),7) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin5.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin5.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin5.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin5.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin5.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin(xs:integer(-513)) \ No newline at end of file +excel-engineering:dec2bin(xs:integer(-513)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin6.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin6.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin6.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin6.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin6.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin(xs:integer(512)) \ No newline at end of file +excel-engineering:dec2bin(xs:integer(512)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin7.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin7.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin7.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin7.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin7.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin7.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin7.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin7.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin("string") \ No newline at end of file +excel-engineering:dec2bin("string") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin8.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin8.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin8.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin8.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin(xs:integer(100),8.2) \ No newline at end of file +excel-engineering:dec2bin(xs:integer(100),8.2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin9.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin9.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin9.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin9.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin9.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin9.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2bin/excel_dec2bin9.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2bin/excel_dec2bin9.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2bin(512, "string") \ No newline at end of file +excel-engineering:dec2bin(512, "string") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex("100") \ No newline at end of file +excel-engineering:dec2hex("100") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex10.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex10.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex10.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex10.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex10.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex10.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex10.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex10.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex(100,0) \ No newline at end of file +excel-engineering:dec2hex(100,0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex11.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex11.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex11.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex11.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex11.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex11.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex11.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex11.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex(100,-1) \ No newline at end of file +excel-engineering:dec2hex(100,-1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex(-54) \ No newline at end of file +excel-engineering:dec2hex(-54) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex3.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex("100", 4) \ No newline at end of file +excel-engineering:dec2hex("100", 4) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex4.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex(-54, 3) \ No newline at end of file +excel-engineering:dec2hex(-54, 3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex5.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex5.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex5.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex5.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex5.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex(-549755813889) \ No newline at end of file +excel-engineering:dec2hex(-549755813889) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex6.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex6.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex6.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex6.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex6.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex(xs:integer(549755813888)) \ No newline at end of file +excel-engineering:dec2hex(xs:integer(549755813888)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex7.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex7.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex7.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex7.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex7.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex7.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex7.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex7.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex("string") \ No newline at end of file +excel-engineering:dec2hex("string") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex8.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex8.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex8.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex8.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex(100,4.2) \ No newline at end of file +excel-engineering:dec2hex(100,4.2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex9.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex9.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex9.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex9.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex9.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex9.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2hex/excel_dec2hex9.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2hex/excel_dec2hex9.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2hex(100, "string") \ No newline at end of file +excel-engineering:dec2hex(100, "string") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct(xs:integer(58)) \ No newline at end of file +excel-engineering:dec2oct(xs:integer(58)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct10.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct10.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct10.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct10.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct10.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct10.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct10.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct10.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct(58, 0) \ No newline at end of file +excel-engineering:dec2oct(58, 0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct11.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct11.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct11.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct11.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct11.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct11.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct11.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct11.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct(58, -1) \ No newline at end of file +excel-engineering:dec2oct(58, -1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct(xs:integer(-100)) \ No newline at end of file +excel-engineering:dec2oct(xs:integer(-100)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct3.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct(xs:integer(58),3) \ No newline at end of file +excel-engineering:dec2oct(xs:integer(58),3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct4.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct(xs:integer(-100),5) \ No newline at end of file +excel-engineering:dec2oct(xs:integer(-100),5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct5.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct5.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct5.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct5.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct5.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct(xs:integer(-536870913)) \ No newline at end of file +excel-engineering:dec2oct(xs:integer(-536870913)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct6.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct6.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct6.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct6.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct6.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct(xs:integer(536870912)) \ No newline at end of file +excel-engineering:dec2oct(xs:integer(536870912)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct7.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct7.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct7.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct7.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct7.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct7.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct7.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct7.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct("string") \ No newline at end of file +excel-engineering:dec2oct("string") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct8.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct8.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct8.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct8.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct(58, 4.4) \ No newline at end of file +excel-engineering:dec2oct(58, 4.4) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct9.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct9.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct9.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct9.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct9.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct9.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/dec2oct/excel_dec2oct9.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/dec2oct/excel_dec2oct9.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; -excel-engineering:dec2oct(58, "string") \ No newline at end of file +excel-engineering:dec2oct(58, "string") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2bin/excel_hex2bin1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2bin/excel_hex2bin1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2bin/excel_hex2bin1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2bin/excel_hex2bin1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2bin("F",8) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2bin/excel_hex2bin2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2bin/excel_hex2bin2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2bin/excel_hex2bin2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2bin/excel_hex2bin2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2bin("b7") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2bin/excel_hex2bin3.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2bin/excel_hex2bin3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2bin/excel_hex2bin3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2bin/excel_hex2bin3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2bin("F",8) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2dec("A5") \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2dec("FFFFFFFF5B") \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec3.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2dec("3DA408B9") \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec4.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec4.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec4.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec4.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec4.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2dec("FEDCBA01234567890") \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec5.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec5.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec5.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec5.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec5.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2dec/excel_hex2dec5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2dec/excel_hex2dec5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2dec("A5S") \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2oct/excel_hex2oct1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2oct/excel_hex2oct1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2oct/excel_hex2oct1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2oct/excel_hex2oct1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2oct("F",3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2oct/excel_hex2oct2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2oct/excel_hex2oct2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2oct/excel_hex2oct2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2oct/excel_hex2oct2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2oct("3b4E") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2oct/excel_hex2oct3.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2oct/excel_hex2oct3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/hex2oct/excel_hex2oct3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/hex2oct/excel_hex2oct3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:hex2oct("FFFFFFFF00") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2bin/excel_oct2bin1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2bin/excel_oct2bin1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2bin/excel_oct2bin1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2bin/excel_oct2bin1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:oct2bin(3,3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2bin/excel_oct2bin2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2bin/excel_oct2bin2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2bin/excel_oct2bin2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2bin/excel_oct2bin2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:oct2bin(7777777000) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:oct2dec("54") \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:oct2dec("7777777533") \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec3.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec3.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec3.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec3.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec3.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:oct2dec("54A") \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec4.spec zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec4.spec --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec4.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec4.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec4.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2dec/excel_oct2dec4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2dec/excel_oct2dec4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:oct2dec("12356671234") \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2hex/excel_oct2hex1.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2hex/excel_oct2hex1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2hex/excel_oct2hex1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2hex/excel_oct2hex1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:oct2hex(100,4) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2hex/excel_oct2hex2.xq zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2hex/excel_oct2hex2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/engineering/oct2hex/excel_oct2hex2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/engineering/oct2hex/excel_oct2hex2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering"; +excel-engineering = "http://zorba.io/modules/excel/engineering"; excel-engineering:oct2hex(7777777533) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/is-blank/excel_is-blank1.xq zorba-excel-module-3.0.0/test/Queries/excel/information/is-blank/excel_is-blank1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/is-blank/excel_is-blank1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/is-blank/excel_is-blank1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:is-blank(()) eq fn:not(excel-information:is-blank((1))) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/is-even/excel_is-even1.xq zorba-excel-module-3.0.0/test/Queries/excel/information/is-even/excel_is-even1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/is-even/excel_is-even1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/is-even/excel_is-even1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:is-even(-1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/is-even/excel_is-even2.xq zorba-excel-module-3.0.0/test/Queries/excel/information/is-even/excel_is-even2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/is-even/excel_is-even2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/is-even/excel_is-even2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:is-even(2.5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/is-even/excel_is-even3.xq zorba-excel-module-3.0.0/test/Queries/excel/information/is-even/excel_is-even3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/is-even/excel_is-even3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/is-even/excel_is-even3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:is-even(5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/is-odd/excel_is-odd1.xq zorba-excel-module-3.0.0/test/Queries/excel/information/is-odd/excel_is-odd1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/is-odd/excel_is-odd1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/is-odd/excel_is-odd1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:is-odd(-1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/is-odd/excel_is-odd2.xq zorba-excel-module-3.0.0/test/Queries/excel/information/is-odd/excel_is-odd2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/is-odd/excel_is-odd2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/is-odd/excel_is-odd2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:is-odd(2.5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/is-odd/excel_is-odd3.xq zorba-excel-module-3.0.0/test/Queries/excel/information/is-odd/excel_is-odd3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/is-odd/excel_is-odd3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/is-odd/excel_is-odd3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:is-odd(5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/islogical/excel_islogical1.xq zorba-excel-module-3.0.0/test/Queries/excel/information/islogical/excel_islogical1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/islogical/excel_islogical1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/islogical/excel_islogical1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:islogical(fn:false()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/islogical/excel_islogical2.xq zorba-excel-module-3.0.0/test/Queries/excel/information/islogical/excel_islogical2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/islogical/excel_islogical2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/islogical/excel_islogical2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:islogical(fn:number(1)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/islogical/excel_islogical3.xq zorba-excel-module-3.0.0/test/Queries/excel/information/islogical/excel_islogical3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/islogical/excel_islogical3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/islogical/excel_islogical3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:islogical(fn:false()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/isnumber/excel_isnumber1.xq zorba-excel-module-3.0.0/test/Queries/excel/information/isnumber/excel_isnumber1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/isnumber/excel_isnumber1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/isnumber/excel_isnumber1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:isnumber(fn:false()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/isnumber/excel_isnumber2.xq zorba-excel-module-3.0.0/test/Queries/excel/information/isnumber/excel_isnumber2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/isnumber/excel_isnumber2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/isnumber/excel_isnumber2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:isnumber(xs:decimal(1)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/isnumber/excel_isnumber3.xq zorba-excel-module-3.0.0/test/Queries/excel/information/isnumber/excel_isnumber3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/isnumber/excel_isnumber3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/isnumber/excel_isnumber3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:isnumber(xs:integer(1)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/isnumber/excel_isnumber4.xq zorba-excel-module-3.0.0/test/Queries/excel/information/isnumber/excel_isnumber4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/isnumber/excel_isnumber4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/isnumber/excel_isnumber4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:isnumber(xs:float(1)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/n/excel_n1.xq zorba-excel-module-3.0.0/test/Queries/excel/information/n/excel_n1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/n/excel_n1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/n/excel_n1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:n(fn:true()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/n/excel_n2.xq zorba-excel-module-3.0.0/test/Queries/excel/information/n/excel_n2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/n/excel_n2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/n/excel_n2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:n(fn:false()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/n/excel_n3.xq zorba-excel-module-3.0.0/test/Queries/excel/information/n/excel_n3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/n/excel_n3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/n/excel_n3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:n(xs:integer(1.3333)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/information/n/excel_n4.xq zorba-excel-module-3.0.0/test/Queries/excel/information/n/excel_n4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/information/n/excel_n4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/information/n/excel_n4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-information = "http://www.zorba-xquery.com/modules/excel/information"; +excel-information = "http://zorba.io/modules/excel/information"; excel-information:n(xs:date("1008-01-01")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/logical/and/excel_and1.xq zorba-excel-module-3.0.0/test/Queries/excel/logical/and/excel_and1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/logical/and/excel_and1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/logical/and/excel_and1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-logical="http://www.zorba-xquery.com/modules/excel/logical"; +excel-logical="http://zorba.io/modules/excel/logical"; excel-logical:and(((2=2),fn:true())) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/logical/and/excel_and2.xq zorba-excel-module-3.0.0/test/Queries/excel/logical/and/excel_and2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/logical/and/excel_and2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/logical/and/excel_and2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-logical="http://www.zorba-xquery.com/modules/excel/logical"; +excel-logical="http://zorba.io/modules/excel/logical"; excel-logical:and(((1=1),(1=1),fn:false())) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/logical/and/excel_and3.xq zorba-excel-module-3.0.0/test/Queries/excel/logical/and/excel_and3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/logical/and/excel_and3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/logical/and/excel_and3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-logical="http://www.zorba-xquery.com/modules/excel/logical"; +excel-logical="http://zorba.io/modules/excel/logical"; excel-logical:and((2=2),fn:true()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/logical/if/excel_if1.xq zorba-excel-module-3.0.0/test/Queries/excel/logical/if/excel_if1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/logical/if/excel_if1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/logical/if/excel_if1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-logical="http://www.zorba-xquery.com/modules/excel/logical"; +excel-logical="http://zorba.io/modules/excel/logical"; excel-logical:if((2=2),fn:true(),fn:false()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/logical/if/excel_if2.xq zorba-excel-module-3.0.0/test/Queries/excel/logical/if/excel_if2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/logical/if/excel_if2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/logical/if/excel_if2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-logical="http://www.zorba-xquery.com/modules/excel/logical"; +excel-logical="http://zorba.io/modules/excel/logical"; excel-logical:if((1=2),fn:true(),fn:false()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/logical/or/excel_or1.xq zorba-excel-module-3.0.0/test/Queries/excel/logical/or/excel_or1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/logical/or/excel_or1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/logical/or/excel_or1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-logical="http://www.zorba-xquery.com/modules/excel/logical"; +excel-logical="http://zorba.io/modules/excel/logical"; excel-logical:or(((1=2),(2=2),fn:false())) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/logical/or/excel_or2.xq zorba-excel-module-3.0.0/test/Queries/excel/logical/or/excel_or2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/logical/or/excel_or2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/logical/or/excel_or2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-logical="http://www.zorba-xquery.com/modules/excel/logical"; +excel-logical="http://zorba.io/modules/excel/logical"; excel-logical:or(((1=2),(2=1),fn:false())) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/logical/or/excel_or3.spec zorba-excel-module-3.0.0/test/Queries/excel/logical/or/excel_or3.spec --- zorba-excel-module-2.9.1/test/Queries/excel/logical/or/excel_or3.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/logical/or/excel_or3.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/logical/or/excel_or3.xq zorba-excel-module-3.0.0/test/Queries/excel/logical/or/excel_or3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/logical/or/excel_or3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/logical/or/excel_or3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-logical="http://www.zorba-xquery.com/modules/excel/logical"; +excel-logical="http://zorba.io/modules/excel/logical"; excel-logical:or(()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/logical/or/excel_or4.xq zorba-excel-module-3.0.0/test/Queries/excel/logical/or/excel_or4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/logical/or/excel_or4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/logical/or/excel_or4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-logical="http://www.zorba-xquery.com/modules/excel/logical"; +excel-logical="http://zorba.io/modules/excel/logical"; excel-logical:or((1=2),(2=2)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/choose1.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/choose1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/choose1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/choose1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:choose(2, (1, 2, 3)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/choose2.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/choose2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/choose2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/choose2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:choose(2, (1, 2, 3), (7,6,5), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/hlookup1.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/hlookup1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/hlookup1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/hlookup1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:hlookup(2, ((1, 2, 3), (4, 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/hlookup2.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/hlookup2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/hlookup2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/hlookup2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:hlookup(2, ((1, "2", 3), (4, 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/hlookup3.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/hlookup3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/hlookup3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/hlookup3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:hlookup(fn:true(), ((1, 2, fn:false()), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/hlookup4.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/hlookup4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/hlookup4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/hlookup4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:hlookup(".3", (("21", "22", "23"), (4, 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/hlookup5.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/hlookup5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/hlookup5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/hlookup5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:hlookup("a", ((1, "A", 3), (4, 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/index1.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/index1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/index1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/index1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:index(((1, 2, 3), (4, 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/index2.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/index2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/index2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/index2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:index((1, 2, 3), 1, 3, diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/index3.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/index3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/index3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/index3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:index((1, 2, 3), 3, 1, diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/index4.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/index4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/index4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/index4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:index(((1, 2, 3), (4, 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/index5.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/index5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/index5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/index5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:index(((1, 2, 3), (4, 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup1.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; (: vector form :) excel:lookup(2, (1, 2, 3), (11, 12, 13, 14)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup2.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; (: vector form :) excel:lookup(1.5, (1, 2, 3), (11, 12, 13, 14)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup3.spec zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup3.spec --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup3.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup3.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:NA +Error: http://zorba.io/modules/excel/errors:NA diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup3.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; (: vector form :) excel:lookup(".2", ("11", "12", "13"), (11, 12, 13, 14)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup4.spec zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup4.spec --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup4.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup4.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:NA +Error: http://zorba.io/modules/excel/errors:NA diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup4.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; (: vector form :) excel:lookup(5, (1, 2, 3, 4, 5), (11, 12, 13, 14)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup5.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; (: array form :) excel:lookup(2, diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup6.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; (: array form :) excel:lookup(2, diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup7.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup7.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/lookup7.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/lookup7.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; (: array form :) excel:lookup(4, diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/match1.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/match1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/match1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/match1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:match(2, (-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/match2.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/match2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/match2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/match2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:match(".2", (10, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12), 0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/match3.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/match3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/match3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/match3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:match(2, (10, 9, 5, 1, 8, 6, 2), -1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset1.spec zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset1.spec --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset1.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset1.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:NA +Error: http://zorba.io/modules/excel/errors:NA diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset1.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:offset(((1, 2, 3), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset2.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:offset(((1, 2, 3), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset3.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:offset(((1, 2, 3), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset4.spec zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset4.spec --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset4.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset4.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:NA +Error: http://zorba.io/modules/excel/errors:NA diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset4.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/offset4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/offset4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:offset(((1, 2, 3), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/transpose1.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/transpose1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/transpose1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/transpose1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:transpose(((1, 2, 3, 4, 5)), 5, 1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/transpose2.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/transpose2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/transpose2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/transpose2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:transpose(((1, 2, 3), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/vlookup1.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/vlookup1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/vlookup1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/vlookup1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:vlookup(2, ((1, 2, 3), (4, 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/vlookup2.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/vlookup2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/vlookup2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/vlookup2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:vlookup(5, ((1, 2, 3), ("4", 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/vlookup3.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/vlookup3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/vlookup3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/vlookup3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:vlookup(fn:true(), ((1, 2, 3), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/vlookup4.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/vlookup4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/vlookup4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/vlookup4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:vlookup(".3", (("21", 2, 3), ("22", 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/lookup/vlookup5.xq zorba-excel-module-3.0.0/test/Queries/excel/lookup/vlookup5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/lookup/vlookup5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/lookup/vlookup5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/lookup"; +excel="http://zorba.io/modules/excel/lookup"; excel:vlookup("a", ((1, 2, 3), (4, 5, 6), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/abs1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/abs1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/abs1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/abs1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:abs(2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/abs2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/abs2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/abs2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/abs2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:abs(-2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/abs3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/abs3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/abs3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/abs3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:abs(-2.1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/abs4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/abs4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/abs4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/abs4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:abs(-2.1E0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/abs5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/abs5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/abs5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/abs5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:abs("2") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/abs6.spec zorba-excel-module-3.0.0/test/Queries/excel/math/abs6.spec --- zorba-excel-module-2.9.1/test/Queries/excel/math/abs6.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/abs6.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/abs6.xq zorba-excel-module-3.0.0/test/Queries/excel/math/abs6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/abs6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/abs6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:abs("ss") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:ceiling(2.5, 1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:ceiling(-2.5, -2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling3.spec zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling3.spec --- zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling3.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling3.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:ceiling(-2.5, 2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:ceiling(1.5, 0.1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:ceiling(0.234, 0.01) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling6.xq zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:ceiling(-20.1, -20.2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling7.xq zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling7.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/ceiling7.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/ceiling7.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:ceiling("0.6", "5E-1") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/even1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/even1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/even1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/even1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:even(1.5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/even2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/even2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/even2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/even2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:even(3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/even3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/even3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/even3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/even3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:even(2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/even4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/even4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/even4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/even4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:even(-1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/even5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/even5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/even5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/even5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:even(2.5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/even6.xq zorba-excel-module-3.0.0/test/Queries/excel/math/even6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/even6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/even6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:even(0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/fact1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/fact1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/fact1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/fact1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:fact(5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/fact2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/fact2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/fact2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/fact2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:fact(1.9) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/fact3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/fact3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/fact3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/fact3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:fact(0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/fact4.spec zorba-excel-module-3.0.0/test/Queries/excel/math/fact4.spec --- zorba-excel-module-2.9.1/test/Queries/excel/math/fact4.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/fact4.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/fact4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/fact4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/fact4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/fact4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:fact(-1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/fact5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/fact5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/fact5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/fact5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:fact(1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/floor1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/floor1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/floor1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/floor1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:floor(2.5, 1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/floor2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/floor2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/floor2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/floor2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:floor(-2.5, -2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/floor3.spec zorba-excel-module-3.0.0/test/Queries/excel/math/floor3.spec --- zorba-excel-module-2.9.1/test/Queries/excel/math/floor3.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/floor3.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/floor3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/floor3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/floor3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/floor3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:floor(-2.5, 2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/floor4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/floor4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/floor4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/floor4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:floor(1.5, 0.1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/floor5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/floor5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/floor5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/floor5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:floor(0.234, 0.01) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/int1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/int1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/int1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/int1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:int(8.9) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/int2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/int2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/int2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/int2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:int(-8.9) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/int3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/int3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/int3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/int3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:int(19.5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/int4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/int4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/int4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/int4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:int(-4.3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/mod1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/mod1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/mod1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/mod1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:mod(3,2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/mod2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/mod2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/mod2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/mod2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:mod(-3,2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/mod3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/mod3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/mod3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/mod3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:mod(3,-2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/mod4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/mod4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/mod4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/mod4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:mod(-3,-2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/odd1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/odd1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/odd1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/odd1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:odd(1.5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/odd2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/odd2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/odd2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/odd2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:odd(3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/odd3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/odd3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/odd3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/odd3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:odd(2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/odd4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/odd4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/odd4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/odd4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:odd(-1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/odd5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/odd5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/odd5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/odd5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:odd(-2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/odd6.xq zorba-excel-module-3.0.0/test/Queries/excel/math/odd6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/odd6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/odd6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:odd(0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/pi1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/pi1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/pi1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/pi1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:pi() diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/power1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/power1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/power1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/power1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:power(5,2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/power3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/power3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/power3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/power3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:power(5,0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/power4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/power4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/power4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/power4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:power(5,1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/power5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/power5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/power5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/power5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:power(5,5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/factdouble1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/factdouble1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/factdouble1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/factdouble1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:factdouble(6) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/factdouble2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/factdouble2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/factdouble2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/factdouble2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:factdouble(7) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:gcd((5, 2)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:gcd((24, 36)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:gcd((7, 1)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:gcd((5, 0)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:gcd((13, 17, 23, 29)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd6.spec zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd6.spec --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd6.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd6.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd6.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:gcd((-5, 0, 2)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd7.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd7.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd7.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd7.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:gcd((3)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd8.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd8.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/gcd8.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/gcd8.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:gcd((6, 12, 15)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/lcm1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/lcm1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/lcm1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/lcm1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:lcm((5,2)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/lcm2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/lcm2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/lcm2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/lcm2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:lcm((24, 36)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/lcm3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/lcm3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/lcm3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/lcm3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:lcm((5,0)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/lcm4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/lcm4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/lcm4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/lcm4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:lcm((2, 4, 8)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/lcm5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/lcm5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/lcm5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/lcm5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:lcm((11, 12, 13)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/mround1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/mround1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/mround1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/mround1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:mround(10, 3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/mround2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/mround2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/mround2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/mround2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:mround(-10, -3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/mround3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/mround3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/mround3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/mround3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:mround(1.3, 0.2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/radians1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/radians1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/radians1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/radians1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:radians(180) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/radians2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/radians2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/radians2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/radians2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:radians(0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/radians3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/radians3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/radians3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/radians3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:radians(-360 - 90) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/roman1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/roman1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/roman1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/roman1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:roman(499) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/roman2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/roman2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/roman2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/roman2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:roman(2009) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/roman3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/roman3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/priority1/roman3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/priority1/roman3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:roman(1555) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/product1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/product1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/product1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/product1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:product((2, 0.5)) \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/product2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/product2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/product2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/product2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:product((5, 15, 30, "0")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/product3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/product3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/product3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/product3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:product((5, 15, 30, -1)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/product4.spec zorba-excel-module-3.0.0/test/Queries/excel/math/product4.spec --- zorba-excel-module-2.9.1/test/Queries/excel/math/product4.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/product4.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/product4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/product4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/product4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/product4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:product((5, 15, 30, "POP")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/product5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/product5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/product5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/product5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:product(()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/quotient1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/quotient1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/quotient1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/quotient1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:quotient(5,2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/quotient2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/quotient2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/quotient2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/quotient2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:quotient(4.5, 3.1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/quotient3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/quotient3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/quotient3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/quotient3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:quotient(-10,3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/quotient4.spec zorba-excel-module-3.0.0/test/Queries/excel/math/quotient4.spec --- zorba-excel-module-2.9.1/test/Queries/excel/math/quotient4.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/quotient4.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Div0 +Error: http://zorba.io/modules/excel/errors:Div0 diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/quotient4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/quotient4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/quotient4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/quotient4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:quotient(1,0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/round1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/round1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/round1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/round1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:round(2.15, 1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/round2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/round2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/round2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/round2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:round(2.149, 1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/round3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/round3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/round3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/round3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:round(-1.475, 2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/round4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/round4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/round4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/round4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:round(21.5, -1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/rounddown1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/rounddown1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/rounddown1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/rounddown1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:rounddown(3.2, 0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/rounddown2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/rounddown2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/rounddown2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/rounddown2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:rounddown(76.9,0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/rounddown3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/rounddown3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/rounddown3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/rounddown3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:rounddown(3.14159, 3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/rounddown4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/rounddown4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/rounddown4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/rounddown4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:rounddown(-3.14159, 1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/rounddown5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/rounddown5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/rounddown5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/rounddown5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:rounddown(31415.92654, -2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/roundup1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/roundup1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/roundup1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/roundup1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:roundup(3.2, 0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/roundup2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/roundup2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/roundup2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/roundup2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:roundup(76.9,0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/roundup3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/roundup3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/roundup3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/roundup3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:roundup(3.14159, 3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/roundup4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/roundup4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/roundup4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/roundup4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:roundup(-3.14159, 1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/roundup5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/roundup5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/roundup5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/roundup5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:roundup(31415.92654, -2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sign1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sign1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sign1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sign1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:sign(100) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sign2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sign2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sign2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sign2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:sign(0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sign3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sign3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sign3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sign3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:sign("-1E100") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sum1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sum1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sum1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sum1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:sum((1,2,3)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sum2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sum2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sum2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sum2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:sum((10, fn:true())) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sum3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sum3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sum3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sum3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:sum(()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct10.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct10.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct10.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct10.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct11.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct11.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct11.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct11.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct12.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct12.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct12.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct12.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct13.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct13.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct13.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct13.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct14.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct14.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct14.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct14.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct15.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct15.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct15.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct15.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct16.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct16.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct16.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct16.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct17.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct17.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct17.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct17.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct18.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct18.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct18.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct18.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct19.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct19.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct19.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct19.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct20.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct20.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct20.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct20.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct21.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct21.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct21.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct21.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct22.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct22.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct22.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct22.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct23.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct23.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct23.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct23.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct24.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct24.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct24.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct24.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct25.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct25.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct25.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct25.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct26.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct26.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct26.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct26.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct27.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct27.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct27.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct27.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct28.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct28.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct28.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct28.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct29.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct29.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct29.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct29.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct30.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct30.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct30.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct30.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct4.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct5.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct6.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct7.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct7.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct7.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct7.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct8.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct8.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct8.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct8.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct9.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct9.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumproduct9.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumproduct9.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel-sumproduct="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel-sumproduct="http://zorba.io/modules/excel/math-sumproduct"; excel-sumproduct:sumproduct((1,2,3,4,5), (1,2,3,4,5), diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/sumsq1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/sumsq1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/sumsq1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/sumsq1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math-sumproduct"; +excel="http://zorba.io/modules/excel/math-sumproduct"; excel:sumsq((1,2,3,4,5)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/trunc1.xq zorba-excel-module-3.0.0/test/Queries/excel/math/trunc1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/trunc1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/trunc1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:trunc(8.9) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/trunc2.xq zorba-excel-module-3.0.0/test/Queries/excel/math/trunc2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/trunc2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/trunc2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:trunc(-8.9) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/math/trunc3.xq zorba-excel-module-3.0.0/test/Queries/excel/math/trunc3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/math/trunc3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/math/trunc3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/math"; +excel="http://zorba.io/modules/excel/math"; excel:trunc(excel:pi(), 2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/average1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/average1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/average1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/average1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:average((2)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/average2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/average2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/average2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/average2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:average((2, 3, 4, 5)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/average3.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/average3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/average3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/average3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:average((2, "", -4)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/count1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/count1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/count1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/count1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:count((2, "1", "", "p", "1E12")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/countblank1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/countblank1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/countblank1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/countblank1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:countblank((2, "0", "", "p", "1E12")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/max1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/max1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/max1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/max1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:max((2, -1, 1E14)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/max2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/max2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/max2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/max2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:max((-1, fn:true())) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/max3.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/max3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/max3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/max3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:max((-1, -2)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/median1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/median1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/median1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/median1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:median((1, 3, 4, 2, 5)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/median2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/median2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/median2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/median2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:median((1, 3, 4, 2)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/min1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/min1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/min1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/min1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:min((2, -1, 1E14)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/min2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/min2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/min2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/min2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:min((3, fn:true())) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/mode1.spec zorba-excel-module-3.0.0/test/Queries/excel/statistical/mode1.spec --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/mode1.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/mode1.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:NA +Error: http://zorba.io/modules/excel/errors:NA diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/mode1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/mode1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/mode1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/mode1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:mode((1, 3, 4, 2, 5)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/mode2.spec zorba-excel-module-3.0.0/test/Queries/excel/statistical/mode2.spec --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/mode2.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/mode2.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/mode2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/mode2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/mode2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/mode2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:mode((1, 3, 4, 2, "l")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/mode3.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/mode3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/mode3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/mode3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:mode((1, 3, 4, 3, 2, 2, 5, 3, 5, "NaN")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/percentile1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/percentile1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/percentile1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/percentile1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:percentile((1, 3, 4, 3, 2, 2, 5, 3, 5), 1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/percentile2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/percentile2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/percentile2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/percentile2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:percentile((1, 3, 4, 3, 2, 2, 5, 3, 5), 0.5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/percentile3.spec zorba-excel-module-3.0.0/test/Queries/excel/statistical/percentile3.spec --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/percentile3.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/percentile3.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/percentile3.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/percentile3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/percentile3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/percentile3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:percentile((1, 3, 4, 3, 2, 2, 5, 3, 5), 5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/avedev1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/avedev1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/avedev1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/avedev1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:avedev((4, 5, 6, 7, 5, 4, 3)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/averagea1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/averagea1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/averagea1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/averagea1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:averagea((4, 5, 6, 7, "x")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/counta1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/counta1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/counta1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/counta1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:counta((4, 5, 6, 7, "x", "")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/large1.spec zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/large1.spec --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/large1.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/large1.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/large1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/large1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/large1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/large1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:large((), 1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/large2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/large2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/large2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/large2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:large((3, 4, 5, 2, 3, 4, 5, 6, 4, 7), 3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/large3.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/large3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/large3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/large3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:large((3, 4, 5, 2, 3, 4, 5, 6, 4, 7), 7 ) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/maxa1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/maxa1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/maxa1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/maxa1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:maxa((0, 0.2, 0.5, 0.4, fn:true()) ) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/mina1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/mina1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/mina1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/mina1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:mina((fn:false(), 0.2, 0.5, 0.4, 0.8) ) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:percentrank((13, 12, 11, 8, 4, 3, 2, 1, 1, 1), 2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:percentrank((13, 12, 11, 8, 4, 3, 2, 1, 1, 1), 4) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank3.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:percentrank((13, 12, 11, 8, 4, 3, 2, 1, 1, 1), 8) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank4.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:percentrank((13, 12, 11, 8, 4, 3, 2, 1, 1, 1), 5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank5.spec zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank5.spec --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank5.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank5.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Num +Error: http://zorba.io/modules/excel/errors:Num diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank5.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/percentrank5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/percentrank5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,5 +1,5 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:percentrank((), 2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/quartile1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/quartile1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/quartile1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/quartile1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:quartile((1, 2, 4, 7, 8, 9, 10, 12), 0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/quartile2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/quartile2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/quartile2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/quartile2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:quartile((1, 2, 4, 7, 8, 9, 10, 12), 1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/quartile3.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/quartile3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/quartile3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/quartile3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:quartile((1, 2, 4, 7, 8, 9, 10, 12), 2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/quartile4.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/quartile4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/quartile4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/quartile4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:quartile((1, 2, 4, 7, 8, 9, 10, 12), 3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/quartile5.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/quartile5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/quartile5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/quartile5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:quartile((1, 2, 4, 7, 8, 9, 10, 12), 4) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/rank1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/rank1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/rank1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/rank1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:rank(3.5, (7, 3.5, 3.5, 1, 2), fn:true() ) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/rank2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/rank2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/rank2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/rank2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:rank(7, (7, 3.5, 3.5, 1, 2), fn:true() ) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/rank3.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/rank3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/rank3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/rank3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:rank(3.5, (7, 3.5, 3.5, 1, 2) ) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/rank4.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/rank4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/rank4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/rank4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:rank(3.5, (2, 3, 4), fn:true() ) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/rank5.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/rank5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/rank5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/rank5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:rank(3.5, (1, 2) ) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/small1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/small1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/small1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/small1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:small((3, 4, 5, 2, 3, 4, 6, 4, 7), 4) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/small2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/small2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/small2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/small2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:small((1, 4, 8, 3, 7, 12, 54, 8, 23), 2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(1, (2, 3, 4)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal10.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal10.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal10.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal10.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(10, (1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal11.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal11.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal11.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal11.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(11, (1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(2, (2, 3, 4, "")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal3.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(3, (2, 3, 4, "", "x")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal4.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(4, (2, 3, 4)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal5.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(5, (2, 3, 4)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal6.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(6, (2, 3, 4)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal7.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal7.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal7.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal7.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(7, (1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal8.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal8.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal8.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal8.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(8, (1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal9.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal9.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/subtotal9.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/subtotal9.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:subtotal(9, (2, 3, 4)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/var1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/var1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/var1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/var1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:var((1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/vara1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/vara1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/vara1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/vara1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:vara((1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, "1299")) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/varp1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/varp1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/varp1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/varp1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:varp((1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/varpa1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/varpa1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority1/varpa1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority1/varpa1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:varpa((1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, "1303", 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority2/prob1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority2/prob1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority2/prob1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority2/prob1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:prob((0, 1, 2, 3), (0.2, 0.3, 0.1, 0.4), 2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority2/prob2.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority2/prob2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority2/prob2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority2/prob2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:prob((0, 1, 2, 3), (0.2, 0.3, 0.1, 0.4), 1, 3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority2/slope1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority2/slope1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority2/slope1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority2/slope1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:slope((2, 3, 9, 1, 8, 7, 5), (6, 5, 11, 7, 5, 4, 4)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority2/standardize1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority2/standardize1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/priority2/standardize1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/priority2/standardize1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical"; +excel="http://zorba.io/modules/excel/statistical"; excel:standardize(42, 40, 1.5) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/stdev1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/stdev1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/stdev1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/stdev1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:stdev((1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/stdeva1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/stdeva1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/stdeva1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/stdeva1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:stdeva((1345, 1301, 1368, 1322, 1310, "1370", 1318, 1350, 1303, 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/stdevp1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/stdevp1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/stdevp1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/stdevp1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:stdevp((1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/statistical/stdevpa1.xq zorba-excel-module-3.0.0/test/Queries/excel/statistical/stdevpa1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/statistical/stdevpa1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/statistical/stdevpa1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel="http://www.zorba-xquery.com/modules/excel/statistical-zorba"; +excel="http://zorba.io/modules/excel/statistical-zorba"; excel:stdevpa((1345, 1301, 1368, 1322, 1310, 1370, "1318", 1350, 1303, 1299)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/asc/excel_asc1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/asc/excel_asc1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/asc/excel_asc1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/asc/excel_asc1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:asc("Thérèse") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/char/excel_char1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/char/excel_char1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/char/excel_char1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/char/excel_char1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:char(65) \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/char/excel_char2.spec zorba-excel-module-3.0.0/test/Queries/excel/text/char/excel_char2.spec --- zorba-excel-module-2.9.1/test/Queries/excel/text/char/excel_char2.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/char/excel_char2.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/char/excel_char2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/char/excel_char2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/char/excel_char2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/char/excel_char2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:char(0) \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/clean/excel_clean1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/clean/excel_clean1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/clean/excel_clean1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/clean/excel_clean1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:clean(fn:codepoints-to-string((45,10,45))) \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/code/excel_code1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/code/excel_code1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/code/excel_code1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/code/excel_code1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:code("AThérèse") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/code/excel_code2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/code/excel_code2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/code/excel_code2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/code/excel_code2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:code("!") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/concatenate/excel_concatenate1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/concatenate/excel_concatenate1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/concatenate/excel_concatenate1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/concatenate/excel_concatenate1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:concatenate("a", xs:integer(3)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/concatenate/excel_concatenate2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/concatenate/excel_concatenate2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/concatenate/excel_concatenate2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/concatenate/excel_concatenate2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:concatenate(('|', 3, '|', 4.4,'|')) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/dollar/excel_dollar1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/dollar/excel_dollar1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/dollar/excel_dollar1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/dollar/excel_dollar1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:dollar(1234.567,2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/dollar/excel_dollar2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/dollar/excel_dollar2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/dollar/excel_dollar2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/dollar/excel_dollar2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:dollar(1234.567,-2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/dollar/excel_dollar3.xq zorba-excel-module-3.0.0/test/Queries/excel/text/dollar/excel_dollar3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/dollar/excel_dollar3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/dollar/excel_dollar3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:dollar(-1234.567,-2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/dollar/excel_dollar4.xq zorba-excel-module-3.0.0/test/Queries/excel/text/dollar/excel_dollar4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/dollar/excel_dollar4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/dollar/excel_dollar4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:dollar(-0.123,4) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/dollar/excel_dollar5.xq zorba-excel-module-3.0.0/test/Queries/excel/text/dollar/excel_dollar5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/dollar/excel_dollar5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/dollar/excel_dollar5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:dollar(99.888) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/exact/excel_exact1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/exact/excel_exact1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/exact/excel_exact1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/exact/excel_exact1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:exact("word","word") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/exact/excel_exact2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/exact/excel_exact2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/exact/excel_exact2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/exact/excel_exact2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:exact("Word","word") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/exact/excel_exact3.xq zorba-excel-module-3.0.0/test/Queries/excel/text/exact/excel_exact3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/exact/excel_exact3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/exact/excel_exact3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:exact("w ord","word") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/find/excel_find1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/find/excel_find1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/find/excel_find1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/find/excel_find1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:find("M","Miriam") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/find/excel_find2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/find/excel_find2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/find/excel_find2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/find/excel_find2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:find("m","Miriam") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/find/excel_find3.xq zorba-excel-module-3.0.0/test/Queries/excel/text/find/excel_find3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/find/excel_find3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/find/excel_find3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:find("m","Miriam",xs:integer(3)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/fixed/excel_fixed1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/fixed/excel_fixed1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/fixed/excel_fixed1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/fixed/excel_fixed1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:fixed(11222333444, 2, fn:true()) \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/fixed/excel_fixed2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/fixed/excel_fixed2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/fixed/excel_fixed2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/fixed/excel_fixed2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:fixed(11222333444, 2, fn:false()) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/fixed/excel_fixed3.xq zorba-excel-module-3.0.0/test/Queries/excel/text/fixed/excel_fixed3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/fixed/excel_fixed3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/fixed/excel_fixed3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:fixed(11222333444, 2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/left/excel_left1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/left/excel_left1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/left/excel_left1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/left/excel_left1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:left('a string', 3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/left/excel_left2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/left/excel_left2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/left/excel_left2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/left/excel_left2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:left('a string') diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/left/excel_left3.xq zorba-excel-module-3.0.0/test/Queries/excel/text/left/excel_left3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/left/excel_left3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/left/excel_left3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:left('a string',100) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/len/excel_len1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/len/excel_len1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/len/excel_len1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/len/excel_len1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; {excel-text:len('a string')} diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/len/excel_len2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/len/excel_len2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/len/excel_len2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/len/excel_len2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; {excel-text:len(())} diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:mid('a string',1,1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:mid('a string',1,100) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid3.xq zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:mid('a string',100,1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid4.spec zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid4.spec --- zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid4.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid4.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid4.xq zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:mid('a string',0,1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid5.xq zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:mid('a string',1,0) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid6.spec zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid6.spec --- zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid6.spec 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid6.spec 2013-11-07 17:11:01.000000000 +0000 @@ -1 +1 @@ -Error: http://www.zorba-xquery.com/modules/excel/errors:Value +Error: http://zorba.io/modules/excel/errors:Value diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid6.xq zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/mid/excel_mid6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/mid/excel_mid6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:mid('a string',3,-1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/replace/excel_replace1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/replace/excel_replace1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/replace/excel_replace1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/replace/excel_replace1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:replace('abcdefghijk',6,5,"*") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/replace/excel_replace2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/replace/excel_replace2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/replace/excel_replace2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/replace/excel_replace2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:replace('2009',3,2,'10') diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/replace/excel_replace3.xq zorba-excel-module-3.0.0/test/Queries/excel/text/replace/excel_replace3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/replace/excel_replace3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/replace/excel_replace3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:replace('123456',1,3,'@') diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/replace/excel_replace4.xq zorba-excel-module-3.0.0/test/Queries/excel/text/replace/excel_replace4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/replace/excel_replace4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/replace/excel_replace4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:replace('abcdefghijk',1,5,"*") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/right/excel_right1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/right/excel_right1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/right/excel_right1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/right/excel_right1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:right('a string',3) \ No newline at end of file diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/right/excel_right2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/right/excel_right2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/right/excel_right2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/right/excel_right2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:right('a string') diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/right/excel_right3.xq zorba-excel-module-3.0.0/test/Queries/excel/text/right/excel_right3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/right/excel_right3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/right/excel_right3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:right('a string',100) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/search/excel_search1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/search/excel_search1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/search/excel_search1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/search/excel_search1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:search("e","Statements",xs:integer(6)) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/search/excel_search2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/search/excel_search2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/search/excel_search2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/search/excel_search2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:search("margin","Profit Margin") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/search/excel_search3.xq zorba-excel-module-3.0.0/test/Queries/excel/text/search/excel_search3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/search/excel_search3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/search/excel_search3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:replace("Profit Margin",excel-text:search("margin","Profit Margin"),6,"Amount") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:substitute("Sales Data","Sales","Cost") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:substitute("Quarter 1, 2008","1","2",1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute3.xq zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute3.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute3.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute3.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:substitute("Quarter 1, 2011","1","2",3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute4.xq zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute4.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute4.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute4.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:substitute("abababa","aba","x",1) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute5.xq zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute5.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute5.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute5.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:substitute("abababa","aba","x",2) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute6.xq zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute6.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute6.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute6.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:substitute("abababa","aba","x",3) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute7.xq zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute7.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/substitute/excel_substitute7.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/substitute/excel_substitute7.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:substitute("abababa","aba","x",6) diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/t/excel_t1.xq zorba-excel-module-3.0.0/test/Queries/excel/text/t/excel_t1.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/t/excel_t1.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/t/excel_t1.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:t("text") diff -Nru zorba-excel-module-2.9.1/test/Queries/excel/text/t/excel_t2.xq zorba-excel-module-3.0.0/test/Queries/excel/text/t/excel_t2.xq --- zorba-excel-module-2.9.1/test/Queries/excel/text/t/excel_t2.xq 2013-05-30 16:28:47.000000000 +0000 +++ zorba-excel-module-3.0.0/test/Queries/excel/text/t/excel_t2.xq 2013-11-07 17:11:01.000000000 +0000 @@ -1,4 +1,4 @@ import module namespace -excel-text = "http://www.zorba-xquery.com/modules/excel/text"; +excel-text = "http://zorba.io/modules/excel/text"; excel-text:t(xs:integer(2))