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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/exist/trunk/xqueryLib/Utilities/inputParse_xquery_lib.xquery@5371
Revision 3841, 805 bytes 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.

  • Property svn:executable set to *
Line 
1module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse';
2
3declare function inputParse:fix-coord($e as element()) as element()
4(: Parse a non-decimal co-ordinate element,  parse to see if it's possible to convert to
5a decimal co-ordinate, and do so, else return the rubbish provided :)
6{
7if ($e castable as xs:decimal) then 
8$e
9else
10let $value := substring(data($e), 1, string-length($e)-1)
11let $point := lower-case(data($e))
12return
13if ($value  castable as xs:decimal) then 
14if (ends-with($point, 'n')) then
15element {name($e)} {$value}
16else if (ends-with($point, 's')) then
17element {name($e)} {concat('-', $value)}
18else if (ends-with($point, 'e')) then
19element {name($e)} {$value}
20else if (ends-with($point, 'w')) then
21element {name($e)} {concat('-', $value)}
22else $e
23else  $e
24} ;
Note: See TracBrowser for help on using the repository browser.