source: exist/trunk/xqueryLib/Utilities/utility_xquery_lib.xquery @ 3841

Subversion URL:
Revision 3841, 1.0 KB checked in by cbyrom, 12 years ago (diff)

Various updates to the xquery files - to remove usage of invalid specs
and dependency on obsolete function calls. Also add the inputParse_xquery_lib.xquery
file - referenced from the xquery files but not currently included in codebase.
NB, changes made to allow use of Saxon java library to do xqueries - to
remove the need for the discovery service eXist DB.

  • NB, also changes tested by comparing saxon transforms to eXist ones; these

were found to be identical.

1module namespace utillib='';
2declare variable $utillib:libversion as xs:decimal := 1.0;
4declare variable $utillib:moles_id_separator as xs:string := '__';
6declare function utillib:kev-strip-namespace($e as element()) as element()
7(: Removes namespace info from the element tree being addressed so that it will lie in the default namespace  :)
9element {QName('', local-name($e))} {
10let $parent :=$e
11let $childcount := count($parent/*)
13if ($childcount>0) then
14for $child in ($e/*)
17else (data($e))
20declare function utillib:strip-namespace($e as element()) as element()
21(: Bryan's version of Kev's code, based on Google and Michael Kay
22which actually does what it says on the  tin, unlike the above :)
24   element {QName((), local-name($e))}
25   {
26     for $child in $e/(@*,node() )
27     return
28       if ($child instance of element())
29       then utillib:strip-namespace($child)
30       else $child
31   }
32 };
Note: See TracBrowser for help on using the repository browser.