Skip to content

Instantly share code, notes, and snippets.

Created December 13, 2017 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/82726cc4b43b4347c82019474634b045 to your computer and use it in GitHub Desktop.
Save anonymous/82726cc4b43b4347c82019474634b045 to your computer and use it in GitHub Desktop.
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