I am trying to run some Xquery code in a java program and I am using the Saxon free java library for this purpose.
Now for some reason I am getting repeated "duplicate function definition" errors when I run this code-- this error is occurring for the "Functx" Xquery library which I downloaded from xqueryfunctions.com.
I dont understand what is wrong here? I am making straightforward calls to some functions in the FunctX Library.
Given below is a section of the error log- it also mentions the line numbers for the "duplicate functions"-- however, when I went to the 2 line numbers I saw that one line number corresponded to the start of that function, while the other line number closed that function.
The library that I am using is at this URL--
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.com/functx-1.0.xq
A section of the error log is given below--
Error on line 2488 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-days-from-duration (see line 2
484 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2502 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-hours-from-duration (see line
2498 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2516 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-minutes-from-duration (see lin
e 2512 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2530 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-months-from-duration (see line
2526 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2544 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-seconds-from-duration (see lin
e 2540 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2558 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...e string to trim :) declare#:
Duplicate definition of function functx:total-years-from-duration (see line
2554 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Now, looking at the last error as shown above-- the line numbers for the duplicate function definition error in functx-1.0.xq are "2558" and "2554"
The relevant code from the file functx-1.0.xq for lines 2554-2558 is now given below--
declare function functx:total-years-from-duration
( $duration as xs:yearMonthDuration? ) as xs:decimal? {
$duration div xs:yearMonthDuration('P1Y')
} ;
How do I resolve this error?