← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-978722_excel into lp:zorba

 

Matthias Brantner has proposed merging lp:~zorba-coders/zorba/bug-978722_excel into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  William Candillon (wcandillon)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-978722_excel/+merge/101523

fix for bug #978722 (change annotation prefix from "ann" to "an")
-- 
The attached diff has been truncated due to its size.
https://code.launchpad.net/~zorba-coders/zorba/bug-978722_excel/+merge/101523
Your team Zorba Coders is subscribed to branch lp:zorba.
=== added file 'CMakeLists.txt'
--- CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ CMakeLists.txt	2012-04-11 10:06:22 +0000
@@ -0,0 +1,38 @@
+# Copyright 2006-2010 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.
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+PROJECT (zorba_excel_module)
+ENABLE_TESTING ()
+INCLUDE (CTest)
+
+LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules")
+
+FIND_PACKAGE (Zorba REQUIRED HINTS "${ZORBA_BUILD_DIR}")
+INCLUDE ("${Zorba_USE_FILE}")
+
+ADD_TEST_DIRECTORY("${PROJECT_SOURCE_DIR}/test")
+ADD_SUBDIRECTORY("src")
+
+IF(NOT ZORBA_WITH_BIG_INTEGER)
+  # These tests fail due to integer overflow.
+  EXPECTED_FAILURE(zorba_excel_module/excel/math/sumproduct28.xq 0)
+  EXPECTED_FAILURE(zorba_excel_module/excel/math/sumproduct29.xq 0)
+  EXPECTED_FAILURE(zorba_excel_module/excel/math/sumproduct30.xq 0)
+ENDIF(NOT ZORBA_WITH_BIG_INTEGER)
+
+DONE_DECLARING_ZORBA_URIS()
+
+# vim:set et sw=2 ts=2:

=== renamed file 'CMakeLists.txt' => 'CMakeLists.txt.moved'
=== added directory 'cmake_modules'
=== renamed directory 'cmake_modules' => 'cmake_modules.moved'
=== added file 'cmake_modules/CMakeCompareVersionStrings.cmake'
--- cmake_modules/CMakeCompareVersionStrings.cmake	1970-01-01 00:00:00 +0000
+++ cmake_modules/CMakeCompareVersionStrings.cmake	2012-04-11 10:06:22 +0000
@@ -0,0 +1,84 @@
+# 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.
+#
+# Computes the realtionship between two version strings.  A version
+# string is a number delineated by '.'s such as 1.3.2 and 0.99.9.1.
+# You can feed version strings with different number of dot versions,
+# and the shorter version number will be padded with zeros: 9.2 <
+# 9.2.1 will actually compare 9.2.0 < 9.2.1.
+#
+# Input: a_in - value, not variable
+#        b_in - value, not variable
+#        result_out - variable with value:
+#                         -1 : a_in <  b_in
+#                          0 : a_in == b_in
+#                          1 : a_in >  b_in
+#
+# Written by James Bigler.
+MACRO(COMPARE_VERSION_STRINGS a_in b_in result_out)
+  # Since SEPARATE_ARGUMENTS using ' ' as the separation token,
+  # replace '.' with ' ' to allow easy tokenization of the string.
+  STRING(REPLACE "." " " a "${a_in}")
+  STRING(REPLACE "." " " b "${b_in}")
+  SEPARATE_ARGUMENTS(a)
+  SEPARATE_ARGUMENTS(b)
+
+  # Check the size of each list to see if they are equal.
+  LIST(LENGTH a a_length)
+  LIST(LENGTH b b_length)
+
+  # Pad the shorter list with zeros.
+
+  # Note that range needs to be one less than the length as the for
+  # loop is inclusive (silly CMake).
+  IF(a_length LESS b_length)
+    # a is shorter
+    SET(shorter a)
+    MATH(EXPR range "${b_length} - 1")
+    MATH(EXPR pad_range "${b_length} - ${a_length} - 1")
+  ELSE(a_length LESS b_length)
+    # b is shorter
+    SET(shorter b)
+    MATH(EXPR range "${a_length} - 1")
+    MATH(EXPR pad_range "${a_length} - ${b_length} - 1")
+  ENDIF(a_length LESS b_length)
+
+  # PAD out if we need to
+  IF(NOT pad_range LESS 0)
+    FOREACH(pad RANGE ${pad_range})
+      # Since shorter is an alias for b, we need to get to it by by dereferencing shorter.
+      LIST(APPEND ${shorter} 0)
+    ENDFOREACH(pad RANGE ${pad_range})
+  ENDIF(NOT pad_range LESS 0)
+
+  SET(result 0)
+  FOREACH(index RANGE ${range})
+    IF(result EQUAL 0)
+      # Only continue to compare things as long as they are equal
+      LIST(GET a ${index} a_version)
+      LIST(GET b ${index} b_version)
+      # LESS
+      IF(a_version LESS b_version)
+        SET(result -1)
+      ENDIF(a_version LESS b_version)
+      # GREATER
+      IF(a_version GREATER b_version)
+        SET(result 1)
+      ENDIF(a_version GREATER b_version)
+    ENDIF(result EQUAL 0)
+  ENDFOREACH(index)
+
+  # Copy out the return result
+  SET(${result_out} ${result})
+ENDMACRO(COMPARE_VERSION_STRINGS)

=== added directory 'src'
=== renamed directory 'src' => 'src.moved'
=== added file 'src/CMakeLists.txt'
--- src/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ src/CMakeLists.txt	2012-04-11 10:06:22 +0000
@@ -0,0 +1,19 @@
+# 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.
+
+# 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")

=== added directory 'src/com'
=== added file 'src/com/CMakeLists.txt'
--- src/com/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ src/com/CMakeLists.txt	2012-04-11 10:06:22 +0000
@@ -0,0 +1,15 @@
+# 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)

=== added directory 'src/com/zorba-xquery'
=== added file 'src/com/zorba-xquery/CMakeLists.txt'
--- src/com/zorba-xquery/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/CMakeLists.txt	2012-04-11 10:06:22 +0000
@@ -0,0 +1,15 @@
+# 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)

=== added directory 'src/com/zorba-xquery/www'
=== added file 'src/com/zorba-xquery/www/CMakeLists.txt'
--- src/com/zorba-xquery/www/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/CMakeLists.txt	2012-04-11 10:06:22 +0000
@@ -0,0 +1,15 @@
+# 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)

=== added directory 'src/com/zorba-xquery/www/modules'
=== added file 'src/com/zorba-xquery/www/modules/CMakeLists.txt'
--- src/com/zorba-xquery/www/modules/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/CMakeLists.txt	2012-04-11 10:06:22 +0000
@@ -0,0 +1,15 @@
+# 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)

=== added directory 'src/com/zorba-xquery/www/modules/excel'
=== added file 'src/com/zorba-xquery/www/modules/excel/CMakeLists.txt'
--- src/com/zorba-xquery/www/modules/excel/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/CMakeLists.txt	2012-04-11 10:06:22 +0000
@@ -0,0 +1,24 @@
+# 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")

=== added file 'src/com/zorba-xquery/www/modules/excel/datetime.xq'
--- src/com/zorba-xquery/www/modules/excel/datetime.xq	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/datetime.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,384 @@
+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 <a href="http://office.microsoft.com/en-us/excel/CH062528231033.aspx";
+ : target="_blank">Excel Documentation: Datetime Functions</a>
+ :
+ : @spec XQuery Specification: January 2007
+ : @author Sorin Nasoi
+ : @project excel
+ :
+ :)
+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.<br/> 
+ : Use this function to help compute payments if your accounting system is based on twelve 30-day months.<br/> 
+ : 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. <br/> 
+ : 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. <br />
+ :The European Method (30E/360)<br />
+ : - If either date A or B falls on the 31st of the month, that date will be changed to the 30th;<br />
+ : - Where date B falls on the last day of February, the actual date B will be used.<br /><br />
+ :
+ :The US/NASD Method (30US/360)<br />
+ : - If both date A and B fall on the last day of February, then date B will be changed to the 30th.<br />
+ : - If date A falls on the 31st of a month or last day of February, then date A will be changed to the 30th.<br />
+ : - 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.<br/>
+ : Working days exclude weekends and any dates identified in holidays.<br/>
+ : 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.<br/> 
+ : Working days exclude weekends and any dates identified in holidays.<br/>
+ : 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  
+};

=== added file 'src/com/zorba-xquery/www/modules/excel/engineering.xq'
--- src/com/zorba-xquery/www/modules/excel/engineering.xq	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/engineering.xq	2012-04-11 10:06:22 +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 <a href="http://office.microsoft.com/en-us/excel/CH062528241033.aspx";
+ : target="_blank">Excel Documentation: Engineering Functions</a>
+ :
+ : @project excel
+ :)
+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)
+};

=== added file 'src/com/zorba-xquery/www/modules/excel/information.xq'
--- src/com/zorba-xquery/www/modules/excel/information.xq	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/information.xq	2012-04-11 10:06:22 +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 <a href="http://office.microsoft.com/en-us/excel/CH062528261033.aspx";
+ : target="_blank">Excel Documentation: Information Functions</a>
+ :
+ : @project excel
+ :)
+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")
+ };

=== added file 'src/com/zorba-xquery/www/modules/excel/logical.xq'
--- src/com/zorba-xquery/www/modules/excel/logical.xq	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/logical.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,120 @@
+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 <a href="http://office.microsoft.com/en-us/excel/CH062528271033.aspx";
+ : target="_blank">Excel Documentation: Logical Functions</a>
+ : @project excel
+ :
+ :)
+(:  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()
+ };

=== added file 'src/com/zorba-xquery/www/modules/excel/lookup.xq'
--- src/com/zorba-xquery/www/modules/excel/lookup.xq	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/lookup.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,842 @@
+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 <a href="http://office.microsoft.com/en-us/excel/CH062528281033.aspx";
+ : target="_blank">Excel 2003 Documentation: Lookup Functions</a>
+ :
+ : @spec XQuery Specification: January 2007
+ : @author Daniel Turcanu
+ : @project excel
+ :
+ :)
+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.  
+ : <dl>Array is specified with 3 parameters:
+ : <dt>table_array</dt> <dd>is a sequence of elements, first row first, then second row and so on</dd>
+ : <dt>table_width</dt> <dd>specifies the number of elements in a row</dd>
+ : <dt>table_height</dt> <dd>specifies the number of rows</dd></dl>
+ : The number of elements in table_array must be equal or more than table_width * table_height.<br/>
+ : 
+ : 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. <br/>
+ :       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 <dl>specifies the algorithm to use:
+ :       <dt>true</dt> <dd>find approximative match. 
+ :              First row of array must be sorted in ascending order.</dd>
+ :       <dt>false</dt> <dd>find exact match, using xquery regex
+ :              First row of array can be in any order.	</dd></dl>
+ : @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. <br/>
+ :       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.<br/>
+ : This is the Array form of the Excel Index function.<br/>
+ : 
+ : <dl>Array is specified with 3 parameters:
+ : <dt>array</dt> <dd>is a sequence of elements, first row first, then second row and so on</dd>
+ : <dt>array_height</dt> <dd>specifies the number of rows</dd>
+ : <dt>array_width</dt> <dd>specifies the number of elements in a row</dd></dl>
+ : 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. <br/>
+ : 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.<br/>
+ : 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.<br/>
+ : 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.<br/>
+ : If array is square or is taller than it is wide (more rows than columns), 
+ :   LOOKUP searches in the first column.<br/>
+ : 
+ : 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 <dl>specifies the algorithm used for searching.
+ :       Possible values:
+ :       <dt>1</dt>  <dd> finds the largest value that is less than or equal to lookup_value.
+ :               Sequence must be in ascending order.</dd>
+ :       <dt>0</dt>  <dd> finds the first value that is exactly equal to lookup_value. <br/>
+ :               Sequence can be in any order.<br/>
+ :               If lookup_value is boolean, then only booleans are compared.<br/>
+ :               For other types, they are casted to string and then compared using 
+ :               xquery regular expressions. Lookup_value can be a xquery regular expression.</dd>
+ :       <dt>-1</dt> <dd> finds the smallest value that is greater than or equal to lookup_value.<br/>
+ :               Sequence must be in descending order.</dd></dl>
+ : @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.
+ : 
+ : <dl>Array is specified with 3 parameters:
+ : <dt>table_array</dt> <dd>is a sequence of elements, first row first, then second row and so on</dd>
+ : <dt>table_width</dt> <dd>specifies the number of elements in a row</dd>
+ : <dt>table_height</dt> <dd>specifies the number of rows</dd></dl>
+ : 
+ : 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. <br/>
+ :       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 <dl>specified the algorithm to use:
+ :       <dt>true</dt> <dd> find approximative match. 
+ :              First column of array must be sorted in ascending order.</dd>
+ :       <dt>false</dt> <dd> find exact match, using xquery regex.
+ :              First column of array can be in any order.</dd></dl>
+ : @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. <br/>
+ :       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())
+};

=== added file 'src/com/zorba-xquery/www/modules/excel/math-sumproduct.xq'
--- src/com/zorba-xquery/www/modules/excel/math-sumproduct.xq	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/math-sumproduct.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2803 @@
+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 <a href="http://office.microsoft.com/en-us/excel/HP052092931033.aspx";
+ : target="_blank">Excel 2003 Documentation: Math-sumproduct Functions</a>
+ :
+ : @spec XQuery Specification: January 2007
+ : @author Daniel Turcanu
+ : @project excel
+ :
+ :)
+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)
+ };
+ 

=== added file 'src/com/zorba-xquery/www/modules/excel/math.xq'
--- src/com/zorba-xquery/www/modules/excel/math.xq	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/math.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,958 @@
+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 <a href="http://office.microsoft.com/en-us/excel/CH062528291033.aspx";
+ : target="_blank">Excel 2003 Documentation: Math Functions</a>
+ :
+ : @spec XQuery Specification: January 2007
+ : @author Daniel Turcanu
+ : @project excel
+ :
+ :)
+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.<br/>
+ : 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.<br/>
+ : LCM for two numbers is computed by multiplying them and dividing with GCD. <br/>
+ : 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).<br/>
+ : M is the largest digit, it represents 1000.
+ : Numbers bigger than 2000 will be represented by a sequence of "M".<br/>
+ : 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
+    ""
+};

=== added file 'src/com/zorba-xquery/www/modules/excel/statistical-zorba.xq'
--- src/com/zorba-xquery/www/modules/excel/statistical-zorba.xq	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/statistical-zorba.xq	2012-04-11 10:06:22 +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 excel
+:)
+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 <dl>defines the function to be applied on sequence values.
+ :       The possible values are:
+ :       <dt>1 or 101</dt> <dd> AVERAGE</dd>
+ :       <dt>2 or 102</dt> <dd> COUNT</dd>
+ :       <dt>3 or 103</dt> <dd> COUNTA</dd>
+ :       <dt>4 or 104</dt> <dd> MAX</dd>
+ :       <dt>5 or 105</dt> <dd> MIN</dd>
+ :       <dt>6 or 106</dt> <dd> PRODUCT</dd>
+ :       <dt>7 or 107</dt> <dd> STDEV</dd>
+ :       <dt>8 or 108</dt> <dd> STDEVP</dd>
+ :       <dt>9 or 109</dt> <dd> SUM</dd>
+ :       <dt>10 or 110</dt> <dd> VAR</dd>
+ :       <dt>11 or 111</dt> <dd> VARP</dd></dl>
+ :       
+ :       In this implementation there is no difference between x and 10x.<br/>
+ : @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")
+};

=== added file 'src/com/zorba-xquery/www/modules/excel/statistical.xq'
--- src/com/zorba-xquery/www/modules/excel/statistical.xq	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/statistical.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,923 @@
+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 <a href="http://office.microsoft.com/en-us/excel/CH062528311033.aspx";
+ : target="_blank">Excel 2003 Documentation: Statistical Functions</a>
+ :
+ : @spec XQuery Specification: January 2007
+ : @author Daniel Turcanu
+ : @project excel
+ :
+ :)
+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 <dl>A boolean having the meaning:
+ :        <dt>false</dt><dd>then rank the number as if the sequence was sorted in descending order.</dd>
+ :        <dt>true</dt> <dd>then rank the number as if the sequence was sorted in ascending order.</dd></dl>
+ : @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. <br/>
+ : 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 <dl>one of the values 0, 1, 2, 3, 4 with meaning:
+ :     <dt>0</dt> <dd> compute minimum value</dd>
+ :     <dt>1</dt> <dd> compute first quartile (25th percentile)</dd>
+ :     <dt>2</dt> <dd> compute median value (50th percentile)</dd>
+ :     <dt>3</dt> <dd> compute third quartile (75th percentile)</dd>
+ :     <dt>4</dt> <dd> compute maximum value</dd></dl>
+ :  @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.<br/>
+ : The formula is sum(x - average_x)^2 / (n - 1).<br/>
+ : average_x is computed with AVERAGE function.<br/>
+ : 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.<br/>
+ : The formula is sum(x - average_x)^2 / (n - 1).<br/>
+ : average_x is computed with AVERAGE function.<br/>
+ : n is the size of sequence, including empty values.<br/>
+ : 
+ : @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.<br/>
+ : The formula is sum(x - average_x)^2 / n.<br/>
+ : average_x is computed with AVERAGE function.<br/>
+ : n is the count of numbers from the sequence, excluding empty values.<br/>
+ : 
+ : @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.<br/>
+ : The formula is sum(x - average_x)^2 / n.<br/>
+ : average_x is computed with AVERAGE function.<br/>
+ : n is the size of sequence, including empty values.<br/>
+ : 
+ : @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:<br/>
+ : sum((x - average_x)(y - average_y)) <br/>
+ : 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:<br/>
+ : sum((x - average_x)(y - average_y)) / sum((x - average_x)^2)  <br/>
+ : 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.<br/>
+ : 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)
+};

=== added file 'src/com/zorba-xquery/www/modules/excel/text.xq'
--- src/com/zorba-xquery/www/modules/excel/text.xq	1970-01-01 00:00:00 +0000
+++ src/com/zorba-xquery/www/modules/excel/text.xq	2012-04-11 10:06:22 +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 <a href="http://office.microsoft.com/en-us/excel/CH062528321033.aspx";
+ : target="_blank">Excel Documentation: Text Functions</a>
+ :
+ : @project excel
+ :)
+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.<br/>
+ : 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.<br />
+ : 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.<br />
+ : 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. <br />
+ : 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. <br/>
+ : In the Unicode character set, there are additional nonprinting characters (values 127, 129, 141, 143, 144, and 157). <br/>
+ : 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. <br/>
+ :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. <br/> 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. <br/> 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.<br/> 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.<br/> 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. <br/>
+ : 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. <br/>
+ : 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.<br/>
+ : 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.<br/>
+ : 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. <br/>
+ : Only that instance of old_text is replaced.
+ : @return  Substitutes new_text for old_text in a text string. <br/> 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)
+};

=== added directory 'test'
=== renamed directory 'test' => 'test.moved'
=== added directory 'test/ExpQueryResults'
=== added directory 'test/ExpQueryResults/excel'
=== added directory 'test/ExpQueryResults/excel/datetime'
=== added directory 'test/ExpQueryResults/excel/datetime/date'
=== added file 'test/ExpQueryResults/excel/datetime/date/excel_date1.xml.res'
--- test/ExpQueryResults/excel/datetime/date/excel_date1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/date/excel_date1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1999-12-31

=== added file 'test/ExpQueryResults/excel/datetime/date/excel_date2.xml.res'
--- test/ExpQueryResults/excel/datetime/date/excel_date2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/date/excel_date2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1999-01-31

=== added directory 'test/ExpQueryResults/excel/datetime/day'
=== added file 'test/ExpQueryResults/excel/datetime/day/excel_day1.xml.res'
--- test/ExpQueryResults/excel/datetime/day/excel_day1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/day/excel_day1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+31

=== added directory 'test/ExpQueryResults/excel/datetime/days360'
=== added file 'test/ExpQueryResults/excel/datetime/days360/excel_days3601.xml.res'
--- test/ExpQueryResults/excel/datetime/days360/excel_days3601.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/days360/excel_days3601.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+86

=== added file 'test/ExpQueryResults/excel/datetime/days360/excel_days3602.xml.res'
--- test/ExpQueryResults/excel/datetime/days360/excel_days3602.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/days360/excel_days3602.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+85

=== added file 'test/ExpQueryResults/excel/datetime/days360/excel_days3603.xml.res'
--- test/ExpQueryResults/excel/datetime/days360/excel_days3603.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/days360/excel_days3603.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-32

=== added file 'test/ExpQueryResults/excel/datetime/days360/excel_days3604.xml.res'
--- test/ExpQueryResults/excel/datetime/days360/excel_days3604.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/days360/excel_days3604.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-33

=== added file 'test/ExpQueryResults/excel/datetime/days360/excel_days3605.xml.res'
--- test/ExpQueryResults/excel/datetime/days360/excel_days3605.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/days360/excel_days3605.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+86

=== added file 'test/ExpQueryResults/excel/datetime/days360/excel_days3606.xml.res'
--- test/ExpQueryResults/excel/datetime/days360/excel_days3606.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/days360/excel_days3606.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-32

=== added directory 'test/ExpQueryResults/excel/datetime/hour'
=== added file 'test/ExpQueryResults/excel/datetime/hour/excel_hour1.xml.res'
--- test/ExpQueryResults/excel/datetime/hour/excel_hour1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/hour/excel_hour1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/datetime/hour/excel_hour2.xml.res'
--- test/ExpQueryResults/excel/datetime/hour/excel_hour2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/hour/excel_hour2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+15

=== added file 'test/ExpQueryResults/excel/datetime/hour/excel_hour3.xml.res'
--- test/ExpQueryResults/excel/datetime/hour/excel_hour3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/hour/excel_hour3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+15

=== added directory 'test/ExpQueryResults/excel/datetime/minute'
=== added file 'test/ExpQueryResults/excel/datetime/minute/excel_minute1.xml.res'
--- test/ExpQueryResults/excel/datetime/minute/excel_minute1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/minute/excel_minute1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+48

=== added directory 'test/ExpQueryResults/excel/datetime/month'
=== added file 'test/ExpQueryResults/excel/datetime/month/excel_month1.xml.res'
--- test/ExpQueryResults/excel/datetime/month/excel_month1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/month/excel_month1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added directory 'test/ExpQueryResults/excel/datetime/networkdays'
=== added file 'test/ExpQueryResults/excel/datetime/networkdays/excel_networkdays1.xml.res'
--- test/ExpQueryResults/excel/datetime/networkdays/excel_networkdays1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/networkdays/excel_networkdays1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+108

=== added file 'test/ExpQueryResults/excel/datetime/networkdays/excel_networkdays2.xml.res'
--- test/ExpQueryResults/excel/datetime/networkdays/excel_networkdays2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/networkdays/excel_networkdays2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+108

=== added file 'test/ExpQueryResults/excel/datetime/networkdays/excel_networkdays3.xml.res'
--- test/ExpQueryResults/excel/datetime/networkdays/excel_networkdays3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/networkdays/excel_networkdays3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+105

=== added directory 'test/ExpQueryResults/excel/datetime/second'
=== added file 'test/ExpQueryResults/excel/datetime/second/excel_second1.xml.res'
--- test/ExpQueryResults/excel/datetime/second/excel_second1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/second/excel_second1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+10.5

=== added directory 'test/ExpQueryResults/excel/datetime/time'
=== added file 'test/ExpQueryResults/excel/datetime/time/excel_time1.xml.res'
--- test/ExpQueryResults/excel/datetime/time/excel_time1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/time/excel_time1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+23:00:00

=== added file 'test/ExpQueryResults/excel/datetime/time/excel_time2.xml.res'
--- test/ExpQueryResults/excel/datetime/time/excel_time2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/time/excel_time2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+23:04:03

=== added directory 'test/ExpQueryResults/excel/datetime/weekday'
=== added file 'test/ExpQueryResults/excel/datetime/weekday/excel_weekday1.xml.res'
--- test/ExpQueryResults/excel/datetime/weekday/excel_weekday1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/weekday/excel_weekday1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added file 'test/ExpQueryResults/excel/datetime/weekday/excel_weekday2.xml.res'
--- test/ExpQueryResults/excel/datetime/weekday/excel_weekday2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/weekday/excel_weekday2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4

=== added file 'test/ExpQueryResults/excel/datetime/weekday/excel_weekday3.xml.res'
--- test/ExpQueryResults/excel/datetime/weekday/excel_weekday3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/weekday/excel_weekday3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/datetime/weekday/excel_weekday4.xml.res'
--- test/ExpQueryResults/excel/datetime/weekday/excel_weekday4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/weekday/excel_weekday4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/datetime/weekday/excel_weekday5.xml.res'
--- test/ExpQueryResults/excel/datetime/weekday/excel_weekday5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/weekday/excel_weekday5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+7

=== added file 'test/ExpQueryResults/excel/datetime/weekday/excel_weekday6.xml.res'
--- test/ExpQueryResults/excel/datetime/weekday/excel_weekday6.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/weekday/excel_weekday6.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+6

=== added directory 'test/ExpQueryResults/excel/datetime/year'
=== added file 'test/ExpQueryResults/excel/datetime/year/excel_year1.xml.res'
--- test/ExpQueryResults/excel/datetime/year/excel_year1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/datetime/year/excel_year1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1999

=== added directory 'test/ExpQueryResults/excel/engineering'
=== added directory 'test/ExpQueryResults/excel/engineering/bin2dec'
=== added file 'test/ExpQueryResults/excel/engineering/bin2dec/excel_bin2dec1.xml.res'
--- test/ExpQueryResults/excel/engineering/bin2dec/excel_bin2dec1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/bin2dec/excel_bin2dec1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+100

=== added file 'test/ExpQueryResults/excel/engineering/bin2dec/excel_bin2dec2.xml.res'
--- test/ExpQueryResults/excel/engineering/bin2dec/excel_bin2dec2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/bin2dec/excel_bin2dec2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-1

=== added directory 'test/ExpQueryResults/excel/engineering/bin2hex'
=== added file 'test/ExpQueryResults/excel/engineering/bin2hex/excel_bin2hex1.xml.res'
--- test/ExpQueryResults/excel/engineering/bin2hex/excel_bin2hex1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/bin2hex/excel_bin2hex1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+00FB

=== added file 'test/ExpQueryResults/excel/engineering/bin2hex/excel_bin2hex2.xml.res'
--- test/ExpQueryResults/excel/engineering/bin2hex/excel_bin2hex2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/bin2hex/excel_bin2hex2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+E

=== added file 'test/ExpQueryResults/excel/engineering/bin2hex/excel_bin2hex3.xml.res'
--- test/ExpQueryResults/excel/engineering/bin2hex/excel_bin2hex3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/bin2hex/excel_bin2hex3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+FFFFFFFFFF

=== added directory 'test/ExpQueryResults/excel/engineering/bin2oct'
=== added file 'test/ExpQueryResults/excel/engineering/bin2oct/excel_bin2oct1.xml.res'
--- test/ExpQueryResults/excel/engineering/bin2oct/excel_bin2oct1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/bin2oct/excel_bin2oct1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+011

=== added file 'test/ExpQueryResults/excel/engineering/bin2oct/excel_bin2oct2.xml.res'
--- test/ExpQueryResults/excel/engineering/bin2oct/excel_bin2oct2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/bin2oct/excel_bin2oct2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+144

=== added file 'test/ExpQueryResults/excel/engineering/bin2oct/excel_bin2oct3.xml.res'
--- test/ExpQueryResults/excel/engineering/bin2oct/excel_bin2oct3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/bin2oct/excel_bin2oct3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+7777777777

=== added directory 'test/ExpQueryResults/excel/engineering/dec2bin'
=== added file 'test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin1.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1100100

=== added file 'test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin2.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1111111111

=== added file 'test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin3.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+01100100

=== added file 'test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin4.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1111111111

=== added file 'test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin8.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin8.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2bin/excel_dec2bin8.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+01100100

=== added directory 'test/ExpQueryResults/excel/engineering/dec2hex'
=== added file 'test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex1.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+64

=== added file 'test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex2.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+FFFFFFFFCA

=== added file 'test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex3.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0064

=== added file 'test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex4.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+FFFFFFFFCA

=== added file 'test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex8.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex8.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2hex/excel_dec2hex8.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0064

=== added directory 'test/ExpQueryResults/excel/engineering/dec2oct'
=== added file 'test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct1.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+72

=== added file 'test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct2.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+7777777634

=== added file 'test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct3.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+072

=== added file 'test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct4.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+7777777634

=== added file 'test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct8.xml.res'
--- test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct8.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/dec2oct/excel_dec2oct8.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0072

=== added directory 'test/ExpQueryResults/excel/engineering/hex2bin'
=== added file 'test/ExpQueryResults/excel/engineering/hex2bin/excel_hex2bin1.xml.res'
--- test/ExpQueryResults/excel/engineering/hex2bin/excel_hex2bin1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/hex2bin/excel_hex2bin1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+00001111

=== added file 'test/ExpQueryResults/excel/engineering/hex2bin/excel_hex2bin2.xml.res'
--- test/ExpQueryResults/excel/engineering/hex2bin/excel_hex2bin2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/hex2bin/excel_hex2bin2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+10110111

=== added file 'test/ExpQueryResults/excel/engineering/hex2bin/excel_hex2bin3.xml.res'
--- test/ExpQueryResults/excel/engineering/hex2bin/excel_hex2bin3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/hex2bin/excel_hex2bin3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+00001111

=== added directory 'test/ExpQueryResults/excel/engineering/hex2dec'
=== added file 'test/ExpQueryResults/excel/engineering/hex2dec/excel_hex2dec1.xml.res'
--- test/ExpQueryResults/excel/engineering/hex2dec/excel_hex2dec1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/hex2dec/excel_hex2dec1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+165

=== added file 'test/ExpQueryResults/excel/engineering/hex2dec/excel_hex2dec2.xml.res'
--- test/ExpQueryResults/excel/engineering/hex2dec/excel_hex2dec2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/hex2dec/excel_hex2dec2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-165

=== added file 'test/ExpQueryResults/excel/engineering/hex2dec/excel_hex2dec3.xml.res'
--- test/ExpQueryResults/excel/engineering/hex2dec/excel_hex2dec3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/hex2dec/excel_hex2dec3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1034160313

=== added directory 'test/ExpQueryResults/excel/engineering/hex2oct'
=== added file 'test/ExpQueryResults/excel/engineering/hex2oct/excel_hex2oct1.xml.res'
--- test/ExpQueryResults/excel/engineering/hex2oct/excel_hex2oct1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/hex2oct/excel_hex2oct1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+017

=== added file 'test/ExpQueryResults/excel/engineering/hex2oct/excel_hex2oct2.xml.res'
--- test/ExpQueryResults/excel/engineering/hex2oct/excel_hex2oct2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/hex2oct/excel_hex2oct2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+35516

=== added file 'test/ExpQueryResults/excel/engineering/hex2oct/excel_hex2oct3.xml.res'
--- test/ExpQueryResults/excel/engineering/hex2oct/excel_hex2oct3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/hex2oct/excel_hex2oct3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+7777777400

=== added directory 'test/ExpQueryResults/excel/engineering/oct2bin'
=== added file 'test/ExpQueryResults/excel/engineering/oct2bin/excel_oct2bin1.xml.res'
--- test/ExpQueryResults/excel/engineering/oct2bin/excel_oct2bin1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/oct2bin/excel_oct2bin1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+011

=== added file 'test/ExpQueryResults/excel/engineering/oct2bin/excel_oct2bin2.xml.res'
--- test/ExpQueryResults/excel/engineering/oct2bin/excel_oct2bin2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/oct2bin/excel_oct2bin2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1000000000

=== added directory 'test/ExpQueryResults/excel/engineering/oct2dec'
=== added file 'test/ExpQueryResults/excel/engineering/oct2dec/excel_oct2dec1.xml.res'
--- test/ExpQueryResults/excel/engineering/oct2dec/excel_oct2dec1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/oct2dec/excel_oct2dec1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+44

=== added file 'test/ExpQueryResults/excel/engineering/oct2dec/excel_oct2dec2.xml.res'
--- test/ExpQueryResults/excel/engineering/oct2dec/excel_oct2dec2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/oct2dec/excel_oct2dec2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-165

=== added directory 'test/ExpQueryResults/excel/engineering/oct2hex'
=== added file 'test/ExpQueryResults/excel/engineering/oct2hex/excel_oct2hex1.xml.res'
--- test/ExpQueryResults/excel/engineering/oct2hex/excel_oct2hex1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/oct2hex/excel_oct2hex1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0040

=== added file 'test/ExpQueryResults/excel/engineering/oct2hex/excel_oct2hex2.xml.res'
--- test/ExpQueryResults/excel/engineering/oct2hex/excel_oct2hex2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/engineering/oct2hex/excel_oct2hex2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+FFFFFFFF5B

=== added directory 'test/ExpQueryResults/excel/information'
=== added directory 'test/ExpQueryResults/excel/information/is-blank'
=== added file 'test/ExpQueryResults/excel/information/is-blank/excel_is-blank1.xml.res'
--- test/ExpQueryResults/excel/information/is-blank/excel_is-blank1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/is-blank/excel_is-blank1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added directory 'test/ExpQueryResults/excel/information/is-even'
=== added file 'test/ExpQueryResults/excel/information/is-even/excel_is-even1.xml.res'
--- test/ExpQueryResults/excel/information/is-even/excel_is-even1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/is-even/excel_is-even1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+false

=== added file 'test/ExpQueryResults/excel/information/is-even/excel_is-even2.xml.res'
--- test/ExpQueryResults/excel/information/is-even/excel_is-even2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/is-even/excel_is-even2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added file 'test/ExpQueryResults/excel/information/is-even/excel_is-even3.xml.res'
--- test/ExpQueryResults/excel/information/is-even/excel_is-even3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/is-even/excel_is-even3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+false

=== added directory 'test/ExpQueryResults/excel/information/is-odd'
=== added file 'test/ExpQueryResults/excel/information/is-odd/excel_is-odd1.xml.res'
--- test/ExpQueryResults/excel/information/is-odd/excel_is-odd1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/is-odd/excel_is-odd1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added file 'test/ExpQueryResults/excel/information/is-odd/excel_is-odd2.xml.res'
--- test/ExpQueryResults/excel/information/is-odd/excel_is-odd2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/is-odd/excel_is-odd2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+false

=== added file 'test/ExpQueryResults/excel/information/is-odd/excel_is-odd3.xml.res'
--- test/ExpQueryResults/excel/information/is-odd/excel_is-odd3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/is-odd/excel_is-odd3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added directory 'test/ExpQueryResults/excel/information/islogical'
=== added file 'test/ExpQueryResults/excel/information/islogical/excel_islogical1.xml.res'
--- test/ExpQueryResults/excel/information/islogical/excel_islogical1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/islogical/excel_islogical1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added file 'test/ExpQueryResults/excel/information/islogical/excel_islogical2.xml.res'
--- test/ExpQueryResults/excel/information/islogical/excel_islogical2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/islogical/excel_islogical2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+false

=== added file 'test/ExpQueryResults/excel/information/islogical/excel_islogical3.xml.res'
--- test/ExpQueryResults/excel/information/islogical/excel_islogical3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/islogical/excel_islogical3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added directory 'test/ExpQueryResults/excel/information/isnumber'
=== added file 'test/ExpQueryResults/excel/information/isnumber/excel_isnumber1.xml.res'
--- test/ExpQueryResults/excel/information/isnumber/excel_isnumber1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/isnumber/excel_isnumber1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+false

=== added file 'test/ExpQueryResults/excel/information/isnumber/excel_isnumber2.xml.res'
--- test/ExpQueryResults/excel/information/isnumber/excel_isnumber2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/isnumber/excel_isnumber2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added file 'test/ExpQueryResults/excel/information/isnumber/excel_isnumber3.xml.res'
--- test/ExpQueryResults/excel/information/isnumber/excel_isnumber3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/isnumber/excel_isnumber3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added file 'test/ExpQueryResults/excel/information/isnumber/excel_isnumber4.xml.res'
--- test/ExpQueryResults/excel/information/isnumber/excel_isnumber4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/isnumber/excel_isnumber4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added directory 'test/ExpQueryResults/excel/information/n'
=== added file 'test/ExpQueryResults/excel/information/n/excel_n1.xml.res'
--- test/ExpQueryResults/excel/information/n/excel_n1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/n/excel_n1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/information/n/excel_n2.xml.res'
--- test/ExpQueryResults/excel/information/n/excel_n2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/n/excel_n2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0

=== added file 'test/ExpQueryResults/excel/information/n/excel_n3.xml.res'
--- test/ExpQueryResults/excel/information/n/excel_n3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/n/excel_n3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/information/n/excel_n4.xml.res'
--- test/ExpQueryResults/excel/information/n/excel_n4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/information/n/excel_n4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0

=== added directory 'test/ExpQueryResults/excel/logical'
=== added directory 'test/ExpQueryResults/excel/logical/and'
=== added file 'test/ExpQueryResults/excel/logical/and/excel_and1.xml.res'
--- test/ExpQueryResults/excel/logical/and/excel_and1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/logical/and/excel_and1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added file 'test/ExpQueryResults/excel/logical/and/excel_and2.xml.res'
--- test/ExpQueryResults/excel/logical/and/excel_and2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/logical/and/excel_and2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+false

=== added file 'test/ExpQueryResults/excel/logical/and/excel_and3.xml.res'
--- test/ExpQueryResults/excel/logical/and/excel_and3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/logical/and/excel_and3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added directory 'test/ExpQueryResults/excel/logical/if'
=== added file 'test/ExpQueryResults/excel/logical/if/excel_if1.xml.res'
--- test/ExpQueryResults/excel/logical/if/excel_if1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/logical/if/excel_if1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added file 'test/ExpQueryResults/excel/logical/if/excel_if2.xml.res'
--- test/ExpQueryResults/excel/logical/if/excel_if2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/logical/if/excel_if2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+false

=== added directory 'test/ExpQueryResults/excel/logical/or'
=== added file 'test/ExpQueryResults/excel/logical/or/excel_or1.xml.res'
--- test/ExpQueryResults/excel/logical/or/excel_or1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/logical/or/excel_or1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added file 'test/ExpQueryResults/excel/logical/or/excel_or2.xml.res'
--- test/ExpQueryResults/excel/logical/or/excel_or2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/logical/or/excel_or2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+false

=== added file 'test/ExpQueryResults/excel/logical/or/excel_or4.xml.res'
--- test/ExpQueryResults/excel/logical/or/excel_or4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/logical/or/excel_or4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added directory 'test/ExpQueryResults/excel/lookup'
=== added file 'test/ExpQueryResults/excel/lookup/choose1.xml.res'
--- test/ExpQueryResults/excel/lookup/choose1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/choose1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/lookup/choose2.xml.res'
--- test/ExpQueryResults/excel/lookup/choose2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/choose2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+7 6 5

=== added file 'test/ExpQueryResults/excel/lookup/hlookup1.xml.res'
--- test/ExpQueryResults/excel/lookup/hlookup1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/hlookup1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added file 'test/ExpQueryResults/excel/lookup/hlookup2.xml.res'
--- test/ExpQueryResults/excel/lookup/hlookup2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/hlookup2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/lookup/hlookup3.xml.res'
--- test/ExpQueryResults/excel/lookup/hlookup3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/hlookup3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+6

=== added file 'test/ExpQueryResults/excel/lookup/hlookup4.xml.res'
--- test/ExpQueryResults/excel/lookup/hlookup4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/hlookup4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+6

=== added file 'test/ExpQueryResults/excel/lookup/hlookup5.xml.res'
--- test/ExpQueryResults/excel/lookup/hlookup5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/hlookup5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added file 'test/ExpQueryResults/excel/lookup/index1.xml.res'
--- test/ExpQueryResults/excel/lookup/index1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/index1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+6

=== added file 'test/ExpQueryResults/excel/lookup/index2.xml.res'
--- test/ExpQueryResults/excel/lookup/index2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/index2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/lookup/index3.xml.res'
--- test/ExpQueryResults/excel/lookup/index3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/index3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/lookup/index4.xml.res'
--- test/ExpQueryResults/excel/lookup/index4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/index4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4 5 6

=== added file 'test/ExpQueryResults/excel/lookup/index5.xml.res'
--- test/ExpQueryResults/excel/lookup/index5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/index5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2 5 8 11

=== added file 'test/ExpQueryResults/excel/lookup/lookup1.xml.res'
--- test/ExpQueryResults/excel/lookup/lookup1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/lookup1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+12

=== added file 'test/ExpQueryResults/excel/lookup/lookup2.xml.res'
--- test/ExpQueryResults/excel/lookup/lookup2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/lookup2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+11

=== added file 'test/ExpQueryResults/excel/lookup/lookup5.xml.res'
--- test/ExpQueryResults/excel/lookup/lookup5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/lookup5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/lookup/lookup6.xml.res'
--- test/ExpQueryResults/excel/lookup/lookup6.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/lookup6.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added file 'test/ExpQueryResults/excel/lookup/lookup7.xml.res'
--- test/ExpQueryResults/excel/lookup/lookup7.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/lookup7.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+6

=== added file 'test/ExpQueryResults/excel/lookup/match1.xml.res'
--- test/ExpQueryResults/excel/lookup/match1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/match1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4

=== added file 'test/ExpQueryResults/excel/lookup/match2.xml.res'
--- test/ExpQueryResults/excel/lookup/match2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/match2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+15

=== added file 'test/ExpQueryResults/excel/lookup/match3.xml.res'
--- test/ExpQueryResults/excel/lookup/match3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/match3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/lookup/offset2.xml.res'
--- test/ExpQueryResults/excel/lookup/offset2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/offset2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5 6 8 9 11 12

=== added file 'test/ExpQueryResults/excel/lookup/offset3.xml.res'
--- test/ExpQueryResults/excel/lookup/offset3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/offset3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5 6 8 9

=== added file 'test/ExpQueryResults/excel/lookup/transpose1.xml.res'
--- test/ExpQueryResults/excel/lookup/transpose1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/transpose1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1 2 3 4 5

=== added file 'test/ExpQueryResults/excel/lookup/transpose2.xml.res'
--- test/ExpQueryResults/excel/lookup/transpose2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/transpose2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1 4 7 10 2 5 8 11 3 6 9 12

=== added file 'test/ExpQueryResults/excel/lookup/vlookup1.xml.res'
--- test/ExpQueryResults/excel/lookup/vlookup1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/vlookup1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/lookup/vlookup2.xml.res'
--- test/ExpQueryResults/excel/lookup/vlookup2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/vlookup2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added file 'test/ExpQueryResults/excel/lookup/vlookup3.xml.res'
--- test/ExpQueryResults/excel/lookup/vlookup3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/vlookup3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+11

=== added file 'test/ExpQueryResults/excel/lookup/vlookup4.xml.res'
--- test/ExpQueryResults/excel/lookup/vlookup4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/vlookup4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+8

=== added file 'test/ExpQueryResults/excel/lookup/vlookup5.xml.res'
--- test/ExpQueryResults/excel/lookup/vlookup5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/lookup/vlookup5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+11

=== added directory 'test/ExpQueryResults/excel/math'
=== added file 'test/ExpQueryResults/excel/math/abs1.xml.res'
--- test/ExpQueryResults/excel/math/abs1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/abs1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/math/abs2.xml.res'
--- test/ExpQueryResults/excel/math/abs2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/abs2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/math/abs3.xml.res'
--- test/ExpQueryResults/excel/math/abs3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/abs3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2.1

=== added file 'test/ExpQueryResults/excel/math/abs4.xml.res'
--- test/ExpQueryResults/excel/math/abs4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/abs4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2.1

=== added file 'test/ExpQueryResults/excel/math/abs5.xml.res'
--- test/ExpQueryResults/excel/math/abs5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/abs5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/math/ceiling1.xml.res'
--- test/ExpQueryResults/excel/math/ceiling1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/ceiling1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/math/ceiling2.xml.res'
--- test/ExpQueryResults/excel/math/ceiling2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/ceiling2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-4

=== added file 'test/ExpQueryResults/excel/math/ceiling3.xml.res'
--- test/ExpQueryResults/excel/math/ceiling3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/ceiling3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/math/ceiling4.xml.res'
--- test/ExpQueryResults/excel/math/ceiling4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/ceiling4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1.5

=== added file 'test/ExpQueryResults/excel/math/ceiling5.xml.res'
--- test/ExpQueryResults/excel/math/ceiling5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/ceiling5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0.24

=== added file 'test/ExpQueryResults/excel/math/ceiling6.xml.res'
--- test/ExpQueryResults/excel/math/ceiling6.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/ceiling6.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-20.2

=== added file 'test/ExpQueryResults/excel/math/ceiling7.xml.res'
--- test/ExpQueryResults/excel/math/ceiling7.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/ceiling7.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/math/even1.xml.res'
--- test/ExpQueryResults/excel/math/even1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/even1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/math/even2.xml.res'
--- test/ExpQueryResults/excel/math/even2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/even2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4

=== added file 'test/ExpQueryResults/excel/math/even3.xml.res'
--- test/ExpQueryResults/excel/math/even3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/even3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/math/even4.xml.res'
--- test/ExpQueryResults/excel/math/even4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/even4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-2

=== added file 'test/ExpQueryResults/excel/math/even5.xml.res'
--- test/ExpQueryResults/excel/math/even5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/even5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4

=== added file 'test/ExpQueryResults/excel/math/even6.xml.res'
--- test/ExpQueryResults/excel/math/even6.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/even6.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0

=== added file 'test/ExpQueryResults/excel/math/fact1.xml.res'
--- test/ExpQueryResults/excel/math/fact1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/fact1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+120
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/fact2.xml.res'
--- test/ExpQueryResults/excel/math/fact2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/fact2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/fact3.xml.res'
--- test/ExpQueryResults/excel/math/fact3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/fact3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/fact4.xml.res'
--- test/ExpQueryResults/excel/math/fact4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/fact4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/fact5.xml.res'
--- test/ExpQueryResults/excel/math/fact5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/fact5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/floor1.xml.res'
--- test/ExpQueryResults/excel/math/floor1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/floor1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/floor2.xml.res'
--- test/ExpQueryResults/excel/math/floor2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/floor2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-2
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/floor4.xml.res'
--- test/ExpQueryResults/excel/math/floor4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/floor4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1.5
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/floor5.xml.res'
--- test/ExpQueryResults/excel/math/floor5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/floor5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0.23
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/int1.xml.res'
--- test/ExpQueryResults/excel/math/int1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/int1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+8
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/int2.xml.res'
--- test/ExpQueryResults/excel/math/int2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/int2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-9
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/int3.xml.res'
--- test/ExpQueryResults/excel/math/int3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/int3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+19
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/int4.xml.res'
--- test/ExpQueryResults/excel/math/int4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/int4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-5
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/mod1.xml.res'
--- test/ExpQueryResults/excel/math/mod1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/mod1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/mod2.xml.res'
--- test/ExpQueryResults/excel/math/mod2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/mod2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/mod3.xml.res'
--- test/ExpQueryResults/excel/math/mod3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/mod3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/mod4.xml.res'
--- test/ExpQueryResults/excel/math/mod4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/mod4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/odd1.xml.res'
--- test/ExpQueryResults/excel/math/odd1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/odd1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/odd2.xml.res'
--- test/ExpQueryResults/excel/math/odd2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/odd2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/odd3.xml.res'
--- test/ExpQueryResults/excel/math/odd3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/odd3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/odd4.xml.res'
--- test/ExpQueryResults/excel/math/odd4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/odd4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/odd5.xml.res'
--- test/ExpQueryResults/excel/math/odd5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/odd5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-3
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/odd6.xml.res'
--- test/ExpQueryResults/excel/math/odd6.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/odd6.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/pi1.xml.res'
--- test/ExpQueryResults/excel/math/pi1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/pi1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3.14159265358979
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/power1.xml.res'
--- test/ExpQueryResults/excel/math/power1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/power1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+25
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/power3.xml.res'
--- test/ExpQueryResults/excel/math/power3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/power3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/power4.xml.res'
--- test/ExpQueryResults/excel/math/power4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/power4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/power5.xml.res'
--- test/ExpQueryResults/excel/math/power5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/power5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3125
\ No newline at end of file

=== added directory 'test/ExpQueryResults/excel/math/priority1'
=== added file 'test/ExpQueryResults/excel/math/priority1/factdouble1.xml.res'
--- test/ExpQueryResults/excel/math/priority1/factdouble1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/factdouble1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+48

=== added file 'test/ExpQueryResults/excel/math/priority1/factdouble2.xml.res'
--- test/ExpQueryResults/excel/math/priority1/factdouble2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/factdouble2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+105

=== added file 'test/ExpQueryResults/excel/math/priority1/gcd1.xml.res'
--- test/ExpQueryResults/excel/math/priority1/gcd1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/gcd1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/math/priority1/gcd2.xml.res'
--- test/ExpQueryResults/excel/math/priority1/gcd2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/gcd2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+12

=== added file 'test/ExpQueryResults/excel/math/priority1/gcd3.xml.res'
--- test/ExpQueryResults/excel/math/priority1/gcd3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/gcd3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/math/priority1/gcd4.xml.res'
--- test/ExpQueryResults/excel/math/priority1/gcd4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/gcd4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added file 'test/ExpQueryResults/excel/math/priority1/gcd5.xml.res'
--- test/ExpQueryResults/excel/math/priority1/gcd5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/gcd5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/math/priority1/gcd7.xml.res'
--- test/ExpQueryResults/excel/math/priority1/gcd7.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/gcd7.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/math/priority1/gcd8.xml.res'
--- test/ExpQueryResults/excel/math/priority1/gcd8.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/gcd8.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/math/priority1/lcm1.xml.res'
--- test/ExpQueryResults/excel/math/priority1/lcm1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/lcm1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+10

=== added file 'test/ExpQueryResults/excel/math/priority1/lcm2.xml.res'
--- test/ExpQueryResults/excel/math/priority1/lcm2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/lcm2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+72
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/priority1/lcm3.xml.res'
--- test/ExpQueryResults/excel/math/priority1/lcm3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/lcm3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0

=== added file 'test/ExpQueryResults/excel/math/priority1/lcm4.xml.res'
--- test/ExpQueryResults/excel/math/priority1/lcm4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/lcm4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+8

=== added file 'test/ExpQueryResults/excel/math/priority1/lcm5.xml.res'
--- test/ExpQueryResults/excel/math/priority1/lcm5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/lcm5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1716

=== added file 'test/ExpQueryResults/excel/math/priority1/mround1.xml.res'
--- test/ExpQueryResults/excel/math/priority1/mround1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/mround1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+9

=== added file 'test/ExpQueryResults/excel/math/priority1/mround2.xml.res'
--- test/ExpQueryResults/excel/math/priority1/mround2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/mround2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-9

=== added file 'test/ExpQueryResults/excel/math/priority1/mround3.xml.res'
--- test/ExpQueryResults/excel/math/priority1/mround3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/mround3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1.4

=== added file 'test/ExpQueryResults/excel/math/priority1/radians1.xml.res'
--- test/ExpQueryResults/excel/math/priority1/radians1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/radians1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3.14159265358979

=== added file 'test/ExpQueryResults/excel/math/priority1/radians2.xml.res'
--- test/ExpQueryResults/excel/math/priority1/radians2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/radians2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0

=== added file 'test/ExpQueryResults/excel/math/priority1/radians3.xml.res'
--- test/ExpQueryResults/excel/math/priority1/radians3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/radians3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-1.570796326794895

=== added file 'test/ExpQueryResults/excel/math/priority1/roman1.xml.res'
--- test/ExpQueryResults/excel/math/priority1/roman1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/roman1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+CDXCIX

=== added file 'test/ExpQueryResults/excel/math/priority1/roman2.xml.res'
--- test/ExpQueryResults/excel/math/priority1/roman2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/roman2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+MMIX

=== added file 'test/ExpQueryResults/excel/math/priority1/roman3.xml.res'
--- test/ExpQueryResults/excel/math/priority1/roman3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/priority1/roman3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+MDLV

=== added file 'test/ExpQueryResults/excel/math/product1.xml.res'
--- test/ExpQueryResults/excel/math/product1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/product1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/product2.xml.res'
--- test/ExpQueryResults/excel/math/product2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/product2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/product3.xml.res'
--- test/ExpQueryResults/excel/math/product3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/product3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-2250
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/product5.xml.res'
--- test/ExpQueryResults/excel/math/product5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/product5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/quotient1.xml.res'
--- test/ExpQueryResults/excel/math/quotient1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/quotient1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/quotient2.xml.res'
--- test/ExpQueryResults/excel/math/quotient2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/quotient2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/quotient3.xml.res'
--- test/ExpQueryResults/excel/math/quotient3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/quotient3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-3
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/round1.xml.res'
--- test/ExpQueryResults/excel/math/round1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/round1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2.2
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/round2.xml.res'
--- test/ExpQueryResults/excel/math/round2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/round2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2.1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/round3.xml.res'
--- test/ExpQueryResults/excel/math/round3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/round3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-1.48
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/round4.xml.res'
--- test/ExpQueryResults/excel/math/round4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/round4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+20
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/rounddown1.xml.res'
--- test/ExpQueryResults/excel/math/rounddown1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/rounddown1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/rounddown2.xml.res'
--- test/ExpQueryResults/excel/math/rounddown2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/rounddown2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+76
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/rounddown3.xml.res'
--- test/ExpQueryResults/excel/math/rounddown3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/rounddown3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3.141
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/rounddown4.xml.res'
--- test/ExpQueryResults/excel/math/rounddown4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/rounddown4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-3.1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/rounddown5.xml.res'
--- test/ExpQueryResults/excel/math/rounddown5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/rounddown5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+31400
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/roundup1.xml.res'
--- test/ExpQueryResults/excel/math/roundup1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/roundup1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/roundup2.xml.res'
--- test/ExpQueryResults/excel/math/roundup2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/roundup2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+77
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/roundup3.xml.res'
--- test/ExpQueryResults/excel/math/roundup3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/roundup3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3.142
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/roundup4.xml.res'
--- test/ExpQueryResults/excel/math/roundup4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/roundup4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-3.2
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/roundup5.xml.res'
--- test/ExpQueryResults/excel/math/roundup5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/roundup5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+31500
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sign1.xml.res'
--- test/ExpQueryResults/excel/math/sign1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sign1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sign2.xml.res'
--- test/ExpQueryResults/excel/math/sign2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sign2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sign3.xml.res'
--- test/ExpQueryResults/excel/math/sign3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sign3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-1
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sum1.xml.res'
--- test/ExpQueryResults/excel/math/sum1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sum1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+6
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sum2.xml.res'
--- test/ExpQueryResults/excel/math/sum2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sum2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+11
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sum3.xml.res'
--- test/ExpQueryResults/excel/math/sum3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sum3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct1.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+15
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct10.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct10.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct10.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+10874275
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct11.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct11.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct11.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+53201625
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct12.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct12.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct12.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+261453379
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct13.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct13.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct13.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1289414505
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct14.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct14.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct14.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+6376750435
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct15.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct15.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct15.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+31605701625
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct16.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct16.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct16.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+156925970179
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct17.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct17.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct17.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+780248593545
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct18.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct18.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct18.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3883804424995
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct19.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct19.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct19.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+19349527020825
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct2.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+55
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct20.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct20.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct20.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+96470431101379
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct21.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct21.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct21.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+481245667164585
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct22.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct22.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct22.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2401809362313955
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct23.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct23.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct23.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+11991391850823225
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct24.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct24.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct24.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+59886402198414979
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct25.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct25.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct25.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+299149971105959625
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct26.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct26.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct26.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1494622260945073315
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct27.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct27.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct27.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+7468602621165012825
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct28.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct28.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct28.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+37324983455717958979
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct29.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct29.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct29.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+186552813930161650665
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct3.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+225
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct30.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct30.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct30.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+932475702012291199075
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct4.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+979
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct5.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4425
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct6.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct6.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct6.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+20515
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct7.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct7.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct7.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+96825
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct8.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct8.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct8.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+462979
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumproduct9.xml.res'
--- test/ExpQueryResults/excel/math/sumproduct9.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumproduct9.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2235465
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/sumsq1.xml.res'
--- test/ExpQueryResults/excel/math/sumsq1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/sumsq1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+55

=== added file 'test/ExpQueryResults/excel/math/trunc1.xml.res'
--- test/ExpQueryResults/excel/math/trunc1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/trunc1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+8
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/trunc2.xml.res'
--- test/ExpQueryResults/excel/math/trunc2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/trunc2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-8
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/math/trunc3.xml.res'
--- test/ExpQueryResults/excel/math/trunc3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/math/trunc3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3.14
\ No newline at end of file

=== added directory 'test/ExpQueryResults/excel/statistical'
=== added file 'test/ExpQueryResults/excel/statistical/average1.xml.res'
--- test/ExpQueryResults/excel/statistical/average1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/average1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/statistical/average2.xml.res'
--- test/ExpQueryResults/excel/statistical/average2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/average2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3.5

=== added file 'test/ExpQueryResults/excel/statistical/average3.xml.res'
--- test/ExpQueryResults/excel/statistical/average3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/average3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-1

=== added file 'test/ExpQueryResults/excel/statistical/count1.xml.res'
--- test/ExpQueryResults/excel/statistical/count1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/count1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/statistical/countblank1.xml.res'
--- test/ExpQueryResults/excel/statistical/countblank1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/countblank1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/statistical/max1.xml.res'
--- test/ExpQueryResults/excel/statistical/max1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/max1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1.0E14

=== added file 'test/ExpQueryResults/excel/statistical/max2.xml.res'
--- test/ExpQueryResults/excel/statistical/max2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/max2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/statistical/max3.xml.res'
--- test/ExpQueryResults/excel/statistical/max3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/max3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-1

=== added file 'test/ExpQueryResults/excel/statistical/median1.xml.res'
--- test/ExpQueryResults/excel/statistical/median1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/median1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/statistical/median2.xml.res'
--- test/ExpQueryResults/excel/statistical/median2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/median2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2.5

=== added file 'test/ExpQueryResults/excel/statistical/min1.xml.res'
--- test/ExpQueryResults/excel/statistical/min1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/min1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+-1

=== added file 'test/ExpQueryResults/excel/statistical/min2.xml.res'
--- test/ExpQueryResults/excel/statistical/min2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/min2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/statistical/mode3.xml.res'
--- test/ExpQueryResults/excel/statistical/mode3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/mode3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/statistical/percentile1.xml.res'
--- test/ExpQueryResults/excel/statistical/percentile1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/percentile1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added file 'test/ExpQueryResults/excel/statistical/percentile2.xml.res'
--- test/ExpQueryResults/excel/statistical/percentile2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/percentile2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added directory 'test/ExpQueryResults/excel/statistical/priority1'
=== added file 'test/ExpQueryResults/excel/statistical/priority1/avedev1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/avedev1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/avedev1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1.020408163265306122

=== added file 'test/ExpQueryResults/excel/statistical/priority1/averagea1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/averagea1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/averagea1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4.4

=== added file 'test/ExpQueryResults/excel/statistical/priority1/counta1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/counta1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/counta1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added file 'test/ExpQueryResults/excel/statistical/priority1/large2.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/large2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/large2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added file 'test/ExpQueryResults/excel/statistical/priority1/large3.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/large3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/large3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4

=== added file 'test/ExpQueryResults/excel/statistical/priority1/maxa1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/maxa1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/maxa1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/statistical/priority1/mina1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/mina1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/mina1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0

=== added file 'test/ExpQueryResults/excel/statistical/priority1/percentrank1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/percentrank1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/percentrank1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0.333333333333333333

=== added file 'test/ExpQueryResults/excel/statistical/priority1/percentrank2.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/percentrank2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/percentrank2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0.555555555555555556

=== added file 'test/ExpQueryResults/excel/statistical/priority1/percentrank3.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/percentrank3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/percentrank3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0.666666666666666667

=== added file 'test/ExpQueryResults/excel/statistical/priority1/percentrank4.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/percentrank4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/percentrank4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0.583333333333333333

=== added file 'test/ExpQueryResults/excel/statistical/priority1/quartile1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/quartile1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/quartile1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/statistical/priority1/quartile2.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/quartile2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/quartile2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3.5

=== added file 'test/ExpQueryResults/excel/statistical/priority1/quartile3.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/quartile3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/quartile3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+7.5

=== added file 'test/ExpQueryResults/excel/statistical/priority1/quartile4.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/quartile4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/quartile4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+9.25

=== added file 'test/ExpQueryResults/excel/statistical/priority1/quartile5.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/quartile5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/quartile5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+12

=== added file 'test/ExpQueryResults/excel/statistical/priority1/rank1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/rank1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/rank1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/statistical/priority1/rank2.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/rank2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/rank2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+5

=== added file 'test/ExpQueryResults/excel/statistical/priority1/rank3.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/rank3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/rank3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/statistical/priority1/rank4.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/rank4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/rank4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2.5

=== added file 'test/ExpQueryResults/excel/statistical/priority1/rank5.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/rank5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/rank5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0

=== added file 'test/ExpQueryResults/excel/statistical/priority1/small1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/small1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/small1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4

=== added file 'test/ExpQueryResults/excel/statistical/priority1/small2.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/small2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/small2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal10.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal10.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal10.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+754.266666666666666667

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal11.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal11.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal11.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+678.84

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal2.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+3

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal3.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal4.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+4

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal5.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal6.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal6.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal6.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+24

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal7.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal7.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal7.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+27.463915719843495

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal8.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal8.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal8.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+26.054558142482477

=== added file 'test/ExpQueryResults/excel/statistical/priority1/subtotal9.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/subtotal9.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/subtotal9.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+9

=== added file 'test/ExpQueryResults/excel/statistical/priority1/var1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/var1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/var1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+754.266666666666666667

=== added file 'test/ExpQueryResults/excel/statistical/priority1/vara1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/vara1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/vara1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+754.266666666666666667

=== added file 'test/ExpQueryResults/excel/statistical/priority1/varp1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/varp1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/varp1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+678.84

=== added file 'test/ExpQueryResults/excel/statistical/priority1/varpa1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority1/varpa1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority1/varpa1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+678.84

=== added directory 'test/ExpQueryResults/excel/statistical/priority2'
=== added file 'test/ExpQueryResults/excel/statistical/priority2/prob1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority2/prob1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority2/prob1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0.1

=== added file 'test/ExpQueryResults/excel/statistical/priority2/prob2.xml.res'
--- test/ExpQueryResults/excel/statistical/priority2/prob2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority2/prob2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0.8

=== added file 'test/ExpQueryResults/excel/statistical/priority2/slope1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority2/slope1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority2/slope1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+0.305555555555555556

=== added file 'test/ExpQueryResults/excel/statistical/priority2/standardize1.xml.res'
--- test/ExpQueryResults/excel/statistical/priority2/standardize1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/priority2/standardize1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1.3333333333333333

=== added file 'test/ExpQueryResults/excel/statistical/stdev1.xml.res'
--- test/ExpQueryResults/excel/statistical/stdev1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/stdev1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+27.463915719843495

=== added file 'test/ExpQueryResults/excel/statistical/stdeva1.xml.res'
--- test/ExpQueryResults/excel/statistical/stdeva1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/stdeva1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+27.463915719843495

=== added file 'test/ExpQueryResults/excel/statistical/stdevp1.xml.res'
--- test/ExpQueryResults/excel/statistical/stdevp1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/stdevp1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+26.054558142482477

=== added file 'test/ExpQueryResults/excel/statistical/stdevpa1.xml.res'
--- test/ExpQueryResults/excel/statistical/stdevpa1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/statistical/stdevpa1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+26.054558142482477

=== added directory 'test/ExpQueryResults/excel/text'
=== added directory 'test/ExpQueryResults/excel/text/asc'
=== added file 'test/ExpQueryResults/excel/text/asc/excel_asc1.xml.res'
--- test/ExpQueryResults/excel/text/asc/excel_asc1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/asc/excel_asc1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,1 @@
+Thérèse
\ No newline at end of file

=== added directory 'test/ExpQueryResults/excel/text/char'
=== added file 'test/ExpQueryResults/excel/text/char/excel_char1.xml.res'
--- test/ExpQueryResults/excel/text/char/excel_char1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/char/excel_char1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,1 @@
+A
\ No newline at end of file

=== added directory 'test/ExpQueryResults/excel/text/clean'
=== added file 'test/ExpQueryResults/excel/text/clean/excel_clean1.xml.res'
--- test/ExpQueryResults/excel/text/clean/excel_clean1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/clean/excel_clean1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+--

=== added directory 'test/ExpQueryResults/excel/text/code'
=== added file 'test/ExpQueryResults/excel/text/code/excel_code1.xml.res'
--- test/ExpQueryResults/excel/text/code/excel_code1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/code/excel_code1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+65

=== added file 'test/ExpQueryResults/excel/text/code/excel_code2.xml.res'
--- test/ExpQueryResults/excel/text/code/excel_code2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/code/excel_code2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+33

=== added directory 'test/ExpQueryResults/excel/text/concatenate'
=== added file 'test/ExpQueryResults/excel/text/concatenate/excel_concatenate1.xml.res'
--- test/ExpQueryResults/excel/text/concatenate/excel_concatenate1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/concatenate/excel_concatenate1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+a3

=== added file 'test/ExpQueryResults/excel/text/concatenate/excel_concatenate2.xml.res'
--- test/ExpQueryResults/excel/text/concatenate/excel_concatenate2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/concatenate/excel_concatenate2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+|3|4.4|

=== added directory 'test/ExpQueryResults/excel/text/dollar'
=== added file 'test/ExpQueryResults/excel/text/dollar/excel_dollar1.xml.res'
--- test/ExpQueryResults/excel/text/dollar/excel_dollar1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/dollar/excel_dollar1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+$1,234.57

=== added file 'test/ExpQueryResults/excel/text/dollar/excel_dollar2.xml.res'
--- test/ExpQueryResults/excel/text/dollar/excel_dollar2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/dollar/excel_dollar2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+$1,200

=== added file 'test/ExpQueryResults/excel/text/dollar/excel_dollar3.xml.res'
--- test/ExpQueryResults/excel/text/dollar/excel_dollar3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/dollar/excel_dollar3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+$1,200

=== added file 'test/ExpQueryResults/excel/text/dollar/excel_dollar4.xml.res'
--- test/ExpQueryResults/excel/text/dollar/excel_dollar4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/dollar/excel_dollar4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+$0.1230

=== added file 'test/ExpQueryResults/excel/text/dollar/excel_dollar5.xml.res'
--- test/ExpQueryResults/excel/text/dollar/excel_dollar5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/dollar/excel_dollar5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+$99.89

=== added directory 'test/ExpQueryResults/excel/text/exact'
=== added file 'test/ExpQueryResults/excel/text/exact/excel_exact1.xml.res'
--- test/ExpQueryResults/excel/text/exact/excel_exact1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/exact/excel_exact1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+true

=== added file 'test/ExpQueryResults/excel/text/exact/excel_exact2.xml.res'
--- test/ExpQueryResults/excel/text/exact/excel_exact2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/exact/excel_exact2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+false

=== added file 'test/ExpQueryResults/excel/text/exact/excel_exact3.xml.res'
--- test/ExpQueryResults/excel/text/exact/excel_exact3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/exact/excel_exact3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+false

=== added directory 'test/ExpQueryResults/excel/text/find'
=== added file 'test/ExpQueryResults/excel/text/find/excel_find1.xml.res'
--- test/ExpQueryResults/excel/text/find/excel_find1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/find/excel_find1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+1

=== added file 'test/ExpQueryResults/excel/text/find/excel_find2.xml.res'
--- test/ExpQueryResults/excel/text/find/excel_find2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/find/excel_find2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+6

=== added file 'test/ExpQueryResults/excel/text/find/excel_find3.xml.res'
--- test/ExpQueryResults/excel/text/find/excel_find3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/find/excel_find3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+6

=== added directory 'test/ExpQueryResults/excel/text/fixed'
=== added file 'test/ExpQueryResults/excel/text/fixed/excel_fixed1.xml.res'
--- test/ExpQueryResults/excel/text/fixed/excel_fixed1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/fixed/excel_fixed1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+11222333444

=== added file 'test/ExpQueryResults/excel/text/fixed/excel_fixed2.xml.res'
--- test/ExpQueryResults/excel/text/fixed/excel_fixed2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/fixed/excel_fixed2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+11,222,333,444

=== added file 'test/ExpQueryResults/excel/text/fixed/excel_fixed3.xml.res'
--- test/ExpQueryResults/excel/text/fixed/excel_fixed3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/fixed/excel_fixed3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+11,222,333,444

=== added directory 'test/ExpQueryResults/excel/text/left'
=== added file 'test/ExpQueryResults/excel/text/left/excel_left1.xml.res'
--- test/ExpQueryResults/excel/text/left/excel_left1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/left/excel_left1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+a s

=== added file 'test/ExpQueryResults/excel/text/left/excel_left2.xml.res'
--- test/ExpQueryResults/excel/text/left/excel_left2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/left/excel_left2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+a

=== added file 'test/ExpQueryResults/excel/text/left/excel_left3.xml.res'
--- test/ExpQueryResults/excel/text/left/excel_left3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/left/excel_left3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+a string

=== added directory 'test/ExpQueryResults/excel/text/len'
=== added file 'test/ExpQueryResults/excel/text/len/excel_len1.xml.res'
--- test/ExpQueryResults/excel/text/len/excel_len1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/len/excel_len1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,1 @@
+<result>8</result>
\ No newline at end of file

=== added file 'test/ExpQueryResults/excel/text/len/excel_len2.xml.res'
--- test/ExpQueryResults/excel/text/len/excel_len2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/len/excel_len2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<result>0</result>

=== added directory 'test/ExpQueryResults/excel/text/mid'
=== added file 'test/ExpQueryResults/excel/text/mid/excel_mid1.xml.res'
--- test/ExpQueryResults/excel/text/mid/excel_mid1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/mid/excel_mid1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+a

=== added file 'test/ExpQueryResults/excel/text/mid/excel_mid2.xml.res'
--- test/ExpQueryResults/excel/text/mid/excel_mid2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/mid/excel_mid2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+a string

=== added file 'test/ExpQueryResults/excel/text/mid/excel_mid3.xml.res'
--- test/ExpQueryResults/excel/text/mid/excel_mid3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/mid/excel_mid3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+

=== added file 'test/ExpQueryResults/excel/text/mid/excel_mid5.xml.res'
--- test/ExpQueryResults/excel/text/mid/excel_mid5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/mid/excel_mid5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+

=== added directory 'test/ExpQueryResults/excel/text/replace'
=== added file 'test/ExpQueryResults/excel/text/replace/excel_replace1.xml.res'
--- test/ExpQueryResults/excel/text/replace/excel_replace1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/replace/excel_replace1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+abcde*k

=== added file 'test/ExpQueryResults/excel/text/replace/excel_replace2.xml.res'
--- test/ExpQueryResults/excel/text/replace/excel_replace2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/replace/excel_replace2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+2010

=== added file 'test/ExpQueryResults/excel/text/replace/excel_replace3.xml.res'
--- test/ExpQueryResults/excel/text/replace/excel_replace3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/replace/excel_replace3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+@456

=== added file 'test/ExpQueryResults/excel/text/replace/excel_replace4.xml.res'
--- test/ExpQueryResults/excel/text/replace/excel_replace4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/replace/excel_replace4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+*fghijk

=== added directory 'test/ExpQueryResults/excel/text/right'
=== added file 'test/ExpQueryResults/excel/text/right/excel_right1.xml.res'
--- test/ExpQueryResults/excel/text/right/excel_right1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/right/excel_right1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ing

=== added file 'test/ExpQueryResults/excel/text/right/excel_right2.xml.res'
--- test/ExpQueryResults/excel/text/right/excel_right2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/right/excel_right2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+g

=== added file 'test/ExpQueryResults/excel/text/right/excel_right3.xml.res'
--- test/ExpQueryResults/excel/text/right/excel_right3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/right/excel_right3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+a string

=== added directory 'test/ExpQueryResults/excel/text/search'
=== added file 'test/ExpQueryResults/excel/text/search/excel_search1.xml.res'
--- test/ExpQueryResults/excel/text/search/excel_search1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/search/excel_search1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+7

=== added file 'test/ExpQueryResults/excel/text/search/excel_search2.xml.res'
--- test/ExpQueryResults/excel/text/search/excel_search2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/search/excel_search2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+8

=== added file 'test/ExpQueryResults/excel/text/search/excel_search3.xml.res'
--- test/ExpQueryResults/excel/text/search/excel_search3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/search/excel_search3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+Profit Amount

=== added directory 'test/ExpQueryResults/excel/text/substitute'
=== added file 'test/ExpQueryResults/excel/text/substitute/excel_substitute1.xml.res'
--- test/ExpQueryResults/excel/text/substitute/excel_substitute1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/substitute/excel_substitute1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+Cost Data

=== added file 'test/ExpQueryResults/excel/text/substitute/excel_substitute2.xml.res'
--- test/ExpQueryResults/excel/text/substitute/excel_substitute2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/substitute/excel_substitute2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+Quarter 2, 2008

=== added file 'test/ExpQueryResults/excel/text/substitute/excel_substitute3.xml.res'
--- test/ExpQueryResults/excel/text/substitute/excel_substitute3.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/substitute/excel_substitute3.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+Quarter 1, 2012

=== added file 'test/ExpQueryResults/excel/text/substitute/excel_substitute4.xml.res'
--- test/ExpQueryResults/excel/text/substitute/excel_substitute4.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/substitute/excel_substitute4.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+xbaba

=== added file 'test/ExpQueryResults/excel/text/substitute/excel_substitute5.xml.res'
--- test/ExpQueryResults/excel/text/substitute/excel_substitute5.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/substitute/excel_substitute5.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+abxba

=== added file 'test/ExpQueryResults/excel/text/substitute/excel_substitute6.xml.res'
--- test/ExpQueryResults/excel/text/substitute/excel_substitute6.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/substitute/excel_substitute6.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ababx

=== added file 'test/ExpQueryResults/excel/text/substitute/excel_substitute7.xml.res'
--- test/ExpQueryResults/excel/text/substitute/excel_substitute7.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/substitute/excel_substitute7.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+abababa

=== added directory 'test/ExpQueryResults/excel/text/t'
=== added file 'test/ExpQueryResults/excel/text/t/excel_t1.xml.res'
--- test/ExpQueryResults/excel/text/t/excel_t1.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/t/excel_t1.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+text

=== added file 'test/ExpQueryResults/excel/text/t/excel_t2.xml.res'
--- test/ExpQueryResults/excel/text/t/excel_t2.xml.res	1970-01-01 00:00:00 +0000
+++ test/ExpQueryResults/excel/text/t/excel_t2.xml.res	2012-04-11 10:06:22 +0000
@@ -0,0 +1,1 @@
+<?xml version="1.0" encoding="UTF-8"?>

=== added directory 'test/Queries'
=== added directory 'test/Queries/excel'
=== added directory 'test/Queries/excel/datetime'
=== added directory 'test/Queries/excel/datetime/date'
=== added file 'test/Queries/excel/datetime/date/excel_date1.xq'
--- test/Queries/excel/datetime/date/excel_date1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/date/excel_date1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:date(1999,12,31)

=== added file 'test/Queries/excel/datetime/date/excel_date2.xq'
--- test/Queries/excel/datetime/date/excel_date2.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/date/excel_date2.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:date(1999,1,31)

=== added directory 'test/Queries/excel/datetime/day'
=== added file 'test/Queries/excel/datetime/day/excel_day1.xq'
--- test/Queries/excel/datetime/day/excel_day1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/day/excel_day1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:day(xs:date("1999-05-31-05:00"))
\ No newline at end of file

=== added directory 'test/Queries/excel/datetime/days360'
=== added file 'test/Queries/excel/datetime/days360/excel_days3601.xq'
--- test/Queries/excel/datetime/days360/excel_days3601.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/days360/excel_days3601.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:days360(xs:date("2008-01-05"), xs:date("2008-03-31"), fn:false())
\ No newline at end of file

=== added file 'test/Queries/excel/datetime/days360/excel_days3602.xq'
--- test/Queries/excel/datetime/days360/excel_days3602.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/days360/excel_days3602.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:days360(xs:date("2008-01-05"), xs:date("2008-03-31"), fn:true())
\ No newline at end of file

=== added file 'test/Queries/excel/datetime/days360/excel_days3603.xq'
--- test/Queries/excel/datetime/days360/excel_days3603.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/days360/excel_days3603.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:days360(xs:date("2008-05-03"), xs:date("2008-03-31"), fn:false())
\ No newline at end of file

=== added file 'test/Queries/excel/datetime/days360/excel_days3604.xq'
--- test/Queries/excel/datetime/days360/excel_days3604.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/days360/excel_days3604.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:days360(xs:date("2008-05-03"), xs:date("2008-03-31"), fn:true())
\ No newline at end of file

=== added file 'test/Queries/excel/datetime/days360/excel_days3605.xq'
--- test/Queries/excel/datetime/days360/excel_days3605.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/days360/excel_days3605.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:days360(xs:date("2008-01-05"), xs:date("2008-03-31"))
\ No newline at end of file

=== added file 'test/Queries/excel/datetime/days360/excel_days3606.xq'
--- test/Queries/excel/datetime/days360/excel_days3606.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/days360/excel_days3606.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:days360(xs:date("2008-05-03"), xs:date("2008-03-31"))
\ No newline at end of file

=== added directory 'test/Queries/excel/datetime/hour'
=== added file 'test/Queries/excel/datetime/hour/excel_hour1.xq'
--- test/Queries/excel/datetime/hour/excel_hour1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/hour/excel_hour1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:hour(xs:time("03:30:30.300"))

=== added file 'test/Queries/excel/datetime/hour/excel_hour2.xq'
--- test/Queries/excel/datetime/hour/excel_hour2.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/hour/excel_hour2.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:hour(xs:time("15:30:30"))

=== added file 'test/Queries/excel/datetime/hour/excel_hour3.xq'
--- test/Queries/excel/datetime/hour/excel_hour3.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/hour/excel_hour3.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:hour(xs:time("15:30:00"))

=== added directory 'test/Queries/excel/datetime/minute'
=== added file 'test/Queries/excel/datetime/minute/excel_minute1.xq'
--- test/Queries/excel/datetime/minute/excel_minute1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/minute/excel_minute1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:minute(xs:time("16:48:00"))

=== added directory 'test/Queries/excel/datetime/month'
=== added file 'test/Queries/excel/datetime/month/excel_month1.xq'
--- test/Queries/excel/datetime/month/excel_month1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/month/excel_month1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:month(xs:date("1999-05-31-05:00"))

=== added directory 'test/Queries/excel/datetime/networkdays'
=== added file 'test/Queries/excel/datetime/networkdays/excel_networkdays1.xq'
--- test/Queries/excel/datetime/networkdays/excel_networkdays1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/networkdays/excel_networkdays1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:networkdays(xs:date("2008-10-01"), xs:date("2009-03-01"))

=== added file 'test/Queries/excel/datetime/networkdays/excel_networkdays2.xq'
--- test/Queries/excel/datetime/networkdays/excel_networkdays2.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/networkdays/excel_networkdays2.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:networkdays(xs:date("2008-10-01"), xs:date("2009-03-01"),())

=== added file 'test/Queries/excel/datetime/networkdays/excel_networkdays3.xq'
--- test/Queries/excel/datetime/networkdays/excel_networkdays3.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/networkdays/excel_networkdays3.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,5 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/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")))

=== added directory 'test/Queries/excel/datetime/second'
=== added file 'test/Queries/excel/datetime/second/excel_second1.xq'
--- test/Queries/excel/datetime/second/excel_second1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/second/excel_second1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:second(xs:time("13:20:10.5"))

=== added directory 'test/Queries/excel/datetime/time'
=== added file 'test/Queries/excel/datetime/time/excel_time1.xq'
--- test/Queries/excel/datetime/time/excel_time1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/time/excel_time1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:time(23,0,0)
\ No newline at end of file

=== added file 'test/Queries/excel/datetime/time/excel_time2.xq'
--- test/Queries/excel/datetime/time/excel_time2.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/time/excel_time2.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:time(23,4,3)

=== added directory 'test/Queries/excel/datetime/weekday'
=== added file 'test/Queries/excel/datetime/weekday/excel_weekday1.xq'
--- test/Queries/excel/datetime/weekday/excel_weekday1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/weekday/excel_weekday1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:weekday(xs:date("2008-02-14"))

=== added file 'test/Queries/excel/datetime/weekday/excel_weekday2.xq'
--- test/Queries/excel/datetime/weekday/excel_weekday2.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/weekday/excel_weekday2.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:weekday(xs:date("2008-02-14"),2)

=== added file 'test/Queries/excel/datetime/weekday/excel_weekday3.xq'
--- test/Queries/excel/datetime/weekday/excel_weekday3.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/weekday/excel_weekday3.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:weekday(xs:date("2008-02-14"),3)

=== added file 'test/Queries/excel/datetime/weekday/excel_weekday4.xq'
--- test/Queries/excel/datetime/weekday/excel_weekday4.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/weekday/excel_weekday4.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:weekday(xs:date("2008-02-10"))

=== added file 'test/Queries/excel/datetime/weekday/excel_weekday5.xq'
--- test/Queries/excel/datetime/weekday/excel_weekday5.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/weekday/excel_weekday5.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:weekday(xs:date("2008-02-10"),2)

=== added file 'test/Queries/excel/datetime/weekday/excel_weekday6.xq'
--- test/Queries/excel/datetime/weekday/excel_weekday6.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/weekday/excel_weekday6.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:weekday(xs:date("2008-02-10"),3)

=== added file 'test/Queries/excel/datetime/weekday/excel_weekday7.spec'
--- test/Queries/excel/datetime/weekday/excel_weekday7.spec	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/weekday/excel_weekday7.spec	2012-04-11 10:06:22 +0000
@@ -0,0 +1,1 @@
+Error: http://www.zorba-xquery.com/modules/excel/errors:Value

=== added file 'test/Queries/excel/datetime/weekday/excel_weekday7.xq'
--- test/Queries/excel/datetime/weekday/excel_weekday7.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/weekday/excel_weekday7.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:weekday(xs:date("2008-02-14"),4)

=== added directory 'test/Queries/excel/datetime/year'
=== added file 'test/Queries/excel/datetime/year/excel_year1.xq'
--- test/Queries/excel/datetime/year/excel_year1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/datetime/year/excel_year1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-datetime = "http://www.zorba-xquery.com/modules/excel/datetime";;
+
+excel-datetime:year(xs:date("1999-05-31"))

=== added directory 'test/Queries/excel/engineering'
=== added directory 'test/Queries/excel/engineering/bin2dec'
=== added file 'test/Queries/excel/engineering/bin2dec/excel_bin2dec1.xq'
--- test/Queries/excel/engineering/bin2dec/excel_bin2dec1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2dec/excel_bin2dec1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:bin2dec("1100100")
\ No newline at end of file

=== added file 'test/Queries/excel/engineering/bin2dec/excel_bin2dec2.xq'
--- test/Queries/excel/engineering/bin2dec/excel_bin2dec2.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2dec/excel_bin2dec2.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:bin2dec("1111111111")  

=== added file 'test/Queries/excel/engineering/bin2dec/excel_bin2dec3.spec'
--- test/Queries/excel/engineering/bin2dec/excel_bin2dec3.spec	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2dec/excel_bin2dec3.spec	2012-04-11 10:06:22 +0000
@@ -0,0 +1,1 @@
+Error: http://www.zorba-xquery.com/modules/excel/errors:Value

=== added file 'test/Queries/excel/engineering/bin2dec/excel_bin2dec3.xq'
--- test/Queries/excel/engineering/bin2dec/excel_bin2dec3.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2dec/excel_bin2dec3.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:bin2dec("11111111110")  

=== added file 'test/Queries/excel/engineering/bin2dec/excel_bin2dec4.spec'
--- test/Queries/excel/engineering/bin2dec/excel_bin2dec4.spec	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2dec/excel_bin2dec4.spec	2012-04-11 10:06:22 +0000
@@ -0,0 +1,1 @@
+Error: http://www.zorba-xquery.com/modules/excel/errors:Value

=== added file 'test/Queries/excel/engineering/bin2dec/excel_bin2dec4.xq'
--- test/Queries/excel/engineering/bin2dec/excel_bin2dec4.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2dec/excel_bin2dec4.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:bin2dec("2111111111")  

=== added directory 'test/Queries/excel/engineering/bin2hex'
=== added file 'test/Queries/excel/engineering/bin2hex/excel_bin2hex1.xq'
--- test/Queries/excel/engineering/bin2hex/excel_bin2hex1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2hex/excel_bin2hex1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:bin2hex(11111011, 4)

=== added file 'test/Queries/excel/engineering/bin2hex/excel_bin2hex2.xq'
--- test/Queries/excel/engineering/bin2hex/excel_bin2hex2.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2hex/excel_bin2hex2.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:bin2hex(1110)

=== added file 'test/Queries/excel/engineering/bin2hex/excel_bin2hex3.xq'
--- test/Queries/excel/engineering/bin2hex/excel_bin2hex3.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2hex/excel_bin2hex3.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:bin2hex(1111111111)

=== added directory 'test/Queries/excel/engineering/bin2oct'
=== added file 'test/Queries/excel/engineering/bin2oct/excel_bin2oct1.xq'
--- test/Queries/excel/engineering/bin2oct/excel_bin2oct1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2oct/excel_bin2oct1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:bin2oct(1001,3)

=== added file 'test/Queries/excel/engineering/bin2oct/excel_bin2oct2.xq'
--- test/Queries/excel/engineering/bin2oct/excel_bin2oct2.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2oct/excel_bin2oct2.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:bin2oct(1100100)
\ No newline at end of file

=== added file 'test/Queries/excel/engineering/bin2oct/excel_bin2oct3.xq'
--- test/Queries/excel/engineering/bin2oct/excel_bin2oct3.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/bin2oct/excel_bin2oct3.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:bin2oct(1111111111)

=== added directory 'test/Queries/excel/engineering/dec2bin'
=== added file 'test/Queries/excel/engineering/dec2bin/excel_dec2bin1.xq'
--- test/Queries/excel/engineering/dec2bin/excel_dec2bin1.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/dec2bin/excel_dec2bin1.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:dec2bin(xs:integer(100))
\ No newline at end of file

=== added file 'test/Queries/excel/engineering/dec2bin/excel_dec2bin10.spec'
--- test/Queries/excel/engineering/dec2bin/excel_dec2bin10.spec	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/dec2bin/excel_dec2bin10.spec	2012-04-11 10:06:22 +0000
@@ -0,0 +1,1 @@
+Error: http://www.zorba-xquery.com/modules/excel/errors:Num

=== added file 'test/Queries/excel/engineering/dec2bin/excel_dec2bin10.xq'
--- test/Queries/excel/engineering/dec2bin/excel_dec2bin10.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/dec2bin/excel_dec2bin10.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:dec2bin(511, 0)
\ No newline at end of file

=== added file 'test/Queries/excel/engineering/dec2bin/excel_dec2bin11.spec'
--- test/Queries/excel/engineering/dec2bin/excel_dec2bin11.spec	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/dec2bin/excel_dec2bin11.spec	2012-04-11 10:06:22 +0000
@@ -0,0 +1,1 @@
+Error: http://www.zorba-xquery.com/modules/excel/errors:Num

=== added file 'test/Queries/excel/engineering/dec2bin/excel_dec2bin11.xq'
--- test/Queries/excel/engineering/dec2bin/excel_dec2bin11.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/dec2bin/excel_dec2bin11.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:dec2bin(511, -1)
\ No newline at end of file

=== added file 'test/Queries/excel/engineering/dec2bin/excel_dec2bin2.xq'
--- test/Queries/excel/engineering/dec2bin/excel_dec2bin2.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/dec2bin/excel_dec2bin2.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:dec2bin(-1)
\ No newline at end of file

=== added file 'test/Queries/excel/engineering/dec2bin/excel_dec2bin3.xq'
--- test/Queries/excel/engineering/dec2bin/excel_dec2bin3.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/dec2bin/excel_dec2bin3.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:dec2bin(xs:integer(100),8)
\ No newline at end of file

=== added file 'test/Queries/excel/engineering/dec2bin/excel_dec2bin4.xq'
--- test/Queries/excel/engineering/dec2bin/excel_dec2bin4.xq	1970-01-01 00:00:00 +0000
+++ test/Queries/excel/engineering/dec2bin/excel_dec2bin4.xq	2012-04-11 10:06:22 +0000
@@ -0,0 +1,4 @@
+import module namespace
+excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";;
+
+excel-engineering:dec2bin(xs:integer(-1),7)
\ No newline at end of file

===

Follow ups