Created
December 13, 2017 10:18
-
-
Save anonymous/82726cc4b43b4347c82019474634b045 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.1"; | |
(: Copy your CSV file to /db/import collection then run in eXide | |
: | |
: Sample csv file : | |
: | |
: Afghanistan;AFG | |
: Albania;ALB | |
: ... | |
: Zambia;ZMB | |
: Zimbabwe;ZWE | |
:) | |
let $data := tokenize( | |
util:binary-to-string(util:binary-doc('/db/import/world-countries.csv')), | |
codepoints-to-string((13)) | |
) | |
return | |
<Selector Name="ISOAlpha3WorldCountries"> | |
{ | |
for $l in $data | |
let $tokens := tokenize($l, ';') | |
return | |
<Option> | |
<Value>{ $tokens[2] }</Value> | |
<Name>{ normalize-space($tokens[1]) }</Name> | |
</Option> | |
} | |
</Selector> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment