source: exist/branches/proglue_production_rev4605_xquery4884/python/build/lib/ndgUtils/xqueryLib/Utilities/inputParse_xquery_lib.xquery @ 4886

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/exist/branches/proglue_production_rev4605_xquery4884/python/build/lib/ndgUtils/xqueryLib/Utilities/inputParse_xquery_lib.xquery@4886
Revision 4886, 805 bytes checked in by sdonegan, 10 years ago (diff)

Creating operational branch for ndgUtils as used on proglue

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.