module namespace j="http://jidanni.org/"; declare function j:ll($x){(:convert eAIP long/lats:) let $x:=replace($x,"^(1\d\d\d\d)(E)$","$100$2") (:add 00 if none E:), $x:=replace($x,"^(\d\d\d\d)(N)$","$100$2") (:add 00 if none N:), $x:=tokenize(replace($x,"^(\d?\d\d)(\d\d)(\d\d(?:\.\d+)?)[NE]$","$1 $2 $3")," ") return(xs:integer($x[1])+(xs:float($x[3]) div 60+xs:integer($x[2]))div 60) }; declare function j:clean($x){replace($x,"([^ -~]|\s)+"," ") };