Re: [xsl] XSLT2 Change country name to alpha-2

Subject: Re: [xsl] XSLT2 Change country name to alpha-2
From: "LEGAULT, PHILLIP plegault@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 2 Jul 2023 11:09:17 -0000
I get the country in like United States.

I have this,
<codes>
  <country alpha-2="AF" name =	"Afghanistan"/>
  <country alpha-2="AL" name =	"Albania"/>
  <country alpha-2="DZ" name =	"Algeria"/>
  <country alpha-2="AS" name =	"American Samoa"/>
  <country alpha-2="AD" name =	"Andorra"/>
  <country alpha-2="AO" name =	"Angola"/>
  <country alpha-2="AI" name =	"Anguilla"/>
  <country alpha-2="AQ" name =	"Antarctica"/>
  <country alpha-2="AG" name =	"Antigua and Barbuda"/>
  <country alpha-2="AR" name =	"Argentina"/>
  <country alpha-2="AM" name =	"Armenia"/>
  <country alpha-2="AW" name =	"Aruba"/>
  <country alpha-2="AU" name =	"Australia"/>
  <country alpha-2="AT" name =	"Austria"/>
  <country alpha-2="AZ" name =	"Azerbaijan"/>
  <country alpha-2="BS" name =	"Bahamas (the)"/>
  <country alpha-2="BH" name =	"Bahrain"/>
  <country alpha-2="BD" name =	"Bangladesh"/>
  <country alpha-2="BB" name =	"Barbados"/>
  <country alpha-2="BY" name =	"Belarus"/>
  <country alpha-2="BE" name =	"Belgium"/>
  <country alpha-2="BZ" name =	"Belize"/>
  <country alpha-2="BJ" name =	"Benin"/>
  <country alpha-2="BM" name =	"Bermuda"/>
  <country alpha-2="BT" name =	"Bhutan"/>
  <country alpha-2="BO" name =	"Bolivia (Plurinational State of)"/>
  <country alpha-2="BQ" name =	"Bonaire, Sint Eustatius and Saba"/>
  <country alpha-2="BA" name =	"Bosnia and Herzegovina"/>
  <country alpha-2="BW" name =	"Botswana"/>
  <country alpha-2="BV" name =	"Bouvet Island"/>
  <country alpha-2="BR" name =	"Brazil"/>
  <country alpha-2="IO" name =	"British Indian Ocean Territory (the)"/>
  <country alpha-2="BN" name =	"Brunei Darussalam"/>
  <country alpha-2="BG" name =	"Bulgaria"/>
  <country alpha-2="BF" name =	"Burkina Faso"/>
  <country alpha-2="BI" name =	"Burundi"/>
  <country alpha-2="CV" name =	"Cabo Verde"/>
  <country alpha-2="KH" name =	"Cambodia"/>
  <country alpha-2="CM" name =	"Cameroon"/>
  <country alpha-2="CA" name =	"Canada"/>
  <country alpha-2="KY" name =	"Cayman Islands (the)"/>
  <country alpha-2="CF" name =	"Central African Republic (the)"/>
  <country alpha-2="TD" name =	"Chad"/>
  <country alpha-2="CL" name =	"Chile"/>
  <country alpha-2="CN" name =	"China"/>
  <country alpha-2="CX" name =	"Christmas Island"/>
  <country alpha-2="CC" name =	"Cocos (Keeling) Islands (the)"/>
  <country alpha-2="CO" name =	"Colombia"/>
  <country alpha-2="KM" name =	"Comoros (the)"/>
  <country alpha-2="CD" name =	"Congo (the Democratic Republic of the)"/>
  <country alpha-2="CG" name =	"Congo (the)"/>
  <country alpha-2="CK" name =	"Cook Islands (the)"/>
  <country alpha-2="CR" name =	"Costa Rica"/>
  <country alpha-2="HR" name =	"Croatia"/>
  <country alpha-2="CU" name =	"Cuba"/>
  <country alpha-2="CW" name =	"CuraC'ao"/>
  <country alpha-2="CY" name =	"Cyprus"/>
  <country alpha-2="CZ" name =	"Czechia"/>
  <country alpha-2="CI" name =	"CC4te d'Ivoire"/>
  <country alpha-2="DK" name =	"Denmark"/>
  <country alpha-2="DJ" name =	"Djibouti"/>
  <country alpha-2="DM" name =	"Dominica"/>
  <country alpha-2="DO" name =	"Dominican Republic (the)"/>
  <country alpha-2="EC" name =	"Ecuador"/>
  <country alpha-2="EG" name =	"Egypt"/>
  <country alpha-2="SV" name =	"El Salvador"/>
  <country alpha-2="GQ" name =	"Equatorial Guinea"/>
  <country alpha-2="ER" name =	"Eritrea"/>
  <country alpha-2="EE" name =	"Estonia"/>
  <country alpha-2="SZ" name =	"Eswatini"/>
  <country alpha-2="ET" name =	"Ethiopia"/>
  <country alpha-2="FK" name =	"Falkland Islands (the) [Malvinas]"/>
  <country alpha-2="FO" name =	"Faroe Islands (the)"/>
  <country alpha-2="FJ" name =	"Fiji"/>
  <country alpha-2="FI" name =	"Finland"/>
  <country alpha-2="FR" name =	"France"/>
  <country alpha-2="GF" name =	"French Guiana"/>
  <country alpha-2="PF" name =	"French Polynesia"/>
  <country alpha-2="TF" name =	"French Southern Territories (the)"/>
  <country alpha-2="GA" name =	"Gabon"/>
  <country alpha-2="GM" name =	"Gambia (the)"/>
  <country alpha-2="GE" name =	"Georgia"/>
  <country alpha-2="DE" name =	"Germany"/>
  <country alpha-2="GH" name =	"Ghana"/>
  <country alpha-2="GI" name =	"Gibraltar"/>
  <country alpha-2="GR" name =	"Greece"/>
  <country alpha-2="GL" name =	"Greenland"/>
  <country alpha-2="GD" name =	"Grenada"/>
  <country alpha-2="GP" name =	"Guadeloupe"/>
  <country alpha-2="GU" name =	"Guam"/>
  <country alpha-2="GT" name =	"Guatemala"/>
  <country alpha-2="GG" name =	"Guernsey"/>
  <country alpha-2="GN" name =	"Guinea"/>
  <country alpha-2="GW" name =	"Guinea-Bissau"/>
  <country alpha-2="GY" name =	"Guyana"/>
  <country alpha-2="HT" name =	"Haiti"/>
  <country alpha-2="HM" name =	"Heard Island and McDonald Islands"/>
  <country alpha-2="VA" name =	"Holy See (the)"/>
  <country alpha-2="HN" name =	"Honduras"/>
  <country alpha-2="HK" name =	"Hong Kong"/>
  <country alpha-2="HU" name =	"Hungary"/>
  <country alpha-2="IS" name =	"Iceland"/>
  <country alpha-2="IN" name =	"India"/>
  <country alpha-2="ID" name =	"Indonesia"/>
  <country alpha-2="IR" name =	"Iran (Islamic Republic of)"/>
  <country alpha-2="IQ" name =	"Iraq"/>
  <country alpha-2="IE" name =	"Ireland"/>
  <country alpha-2="IM" name =	"Isle of Man"/>
  <country alpha-2="IL" name =	"Israel"/>
  <country alpha-2="IT" name =	"Italy"/>
  <country alpha-2="JM" name =	"Jamaica"/>
  <country alpha-2="JP" name =	"Japan"/>
  <country alpha-2="JE" name =	"Jersey"/>
  <country alpha-2="JO" name =	"Jordan"/>
  <country alpha-2="KZ" name =	"Kazakhstan"/>
  <country alpha-2="KE" name =	"Kenya"/>
  <country alpha-2="KI" name =	"Kiribati"/>
  <country alpha-2="KP" name =	"Korea (the Democratic People's Republic of)"/>
  <country alpha-2="KR" name =	"Korea (the Republic of)"/>
  <country alpha-2="KW" name =	"Kuwait"/>
  <country alpha-2="KG" name =	"Kyrgyzstan"/>
  <country alpha-2="LA" name =	"Lao People's Democratic Republic (the)"/>
  <country alpha-2="LV" name =	"Latvia"/>
  <country alpha-2="LB" name =	"Lebanon"/>
  <country alpha-2="LS" name =	"Lesotho"/>
  <country alpha-2="LR" name =	"Liberia"/>
  <country alpha-2="LY" name =	"Libya"/>
  <country alpha-2="LI" name =	"Liechtenstein"/>
  <country alpha-2="LT" name =	"Lithuania"/>
  <country alpha-2="LU" name =	"Luxembourg"/>
  <country alpha-2="MO" name =	"Macao"/>
  <country alpha-2="MG" name =	"Madagascar"/>
  <country alpha-2="MW" name =	"Malawi"/>
  <country alpha-2="MY" name =	"Malaysia"/>
  <country alpha-2="MV" name =	"Maldives"/>
  <country alpha-2="ML" name =	"Mali"/>
  <country alpha-2="MT" name =	"Malta"/>
  <country alpha-2="MH" name =	"Marshall Islands (the)"/>
  <country alpha-2="MQ" name =	"Martinique"/>
  <country alpha-2="MR" name =	"Mauritania"/>
  <country alpha-2="MU" name =	"Mauritius"/>
  <country alpha-2="YT" name =	"Mayotte"/>
  <country alpha-2="MX" name =	"Mexico"/>
  <country alpha-2="FM" name =	"Micronesia (Federated States of)"/>
  <country alpha-2="MD" name =	"Moldova (the Republic of)"/>
  <country alpha-2="MC" name =	"Monaco"/>
  <country alpha-2="MN" name =	"Mongolia"/>
  <country alpha-2="ME" name =	"Montenegro"/>
  <country alpha-2="MS" name =	"Montserrat"/>
  <country alpha-2="MA" name =	"Morocco"/>
  <country alpha-2="MZ" name =	"Mozambique"/>
  <country alpha-2="MM" name =	"Myanmar"/>
  <country alpha-2="NA" name =	"Namibia"/>
  <country alpha-2="NR" name =	"Nauru"/>
  <country alpha-2="NP" name =	"Nepal"/>
  <country alpha-2="NL" name =	"Netherlands (the)"/>
  <country alpha-2="NC" name =	"New Caledonia"/>
  <country alpha-2="NZ" name =	"New Zealand"/>
  <country alpha-2="NI" name =	"Nicaragua"/>
  <country alpha-2="NE" name =	"Niger (the)"/>
  <country alpha-2="NG" name =	"Nigeria"/>
  <country alpha-2="NU" name =	"Niue"/>
  <country alpha-2="NF" name =	"Norfolk Island"/>
  <country alpha-2="MP" name =	"Northern Mariana Islands (the)"/>
  <country alpha-2="NO" name =	"Norway"/>
  <country alpha-2="OM" name =	"Oman"/>
  <country alpha-2="PK" name =	"Pakistan"/>
  <country alpha-2="PW" name =	"Palau"/>
  <country alpha-2="PS" name =	"Palestine, State of"/>
  <country alpha-2="PA" name =	"Panama"/>
  <country alpha-2="PG" name =	"Papua New Guinea"/>
  <country alpha-2="PY" name =	"Paraguay"/>
  <country alpha-2="PE" name =	"Peru"/>
  <country alpha-2="PH" name =	"Philippines (the)"/>
  <country alpha-2="PN" name =	"Pitcairn"/>
  <country alpha-2="PL" name =	"Poland"/>
  <country alpha-2="PT" name =	"Portugal"/>
  <country alpha-2="PR" name =	"Puerto Rico"/>
  <country alpha-2="QA" name =	"Qatar"/>
  <country alpha-2="MK" name =	"Republic of North Macedonia"/>
  <country alpha-2="RO" name =	"Romania"/>
  <country alpha-2="RU" name =	"Russian Federation (the)"/>
  <country alpha-2="RW" name =	"Rwanda"/>
  <country alpha-2="RE" name =	"RC)union"/>
  <country alpha-2="BL" name =	"Saint BarthC)lemy"/>
  <country alpha-2="SH" name =	"Saint Helena, Ascension and Tristan da
Cunha"/>
  <country alpha-2="KN" name =	"Saint Kitts and Nevis"/>
  <country alpha-2="LC" name =	"Saint Lucia"/>
  <country alpha-2="MF" name =	"Saint Martin (French part)"/>
  <country alpha-2="PM" name =	"Saint Pierre and Miquelon"/>
  <country alpha-2="VC" name =	"Saint Vincent and the Grenadines"/>
  <country alpha-2="WS" name =	"Samoa"/>
  <country alpha-2="SM" name =	"San Marino"/>
  <country alpha-2="ST" name =	"Sao Tome and Principe"/>
  <country alpha-2="SA" name =	"Saudi Arabia"/>
  <country alpha-2="SN" name =	"Senegal"/>
  <country alpha-2="RS" name =	"Serbia"/>
  <country alpha-2="SC" name =	"Seychelles"/>
  <country alpha-2="SL" name =	"Sierra Leone"/>
  <country alpha-2="SG" name =	"Singapore"/>
  <country alpha-2="SX" name =	"Sint Maarten (Dutch part)"/>
  <country alpha-2="SK" name =	"Slovakia"/>
  <country alpha-2="SI" name =	"Slovenia"/>
  <country alpha-2="SB" name =	"Solomon Islands"/>
  <country alpha-2="SO" name =	"Somalia"/>
  <country alpha-2="ZA" name =	"South Africa"/>
  <country alpha-2="GS" name =	"South Georgia and the South Sandwich
Islands"/>
  <country alpha-2="SS" name =	"South Sudan"/>
  <country alpha-2="ES" name =	"Spain"/>
  <country alpha-2="LK" name =	"Sri Lanka"/>
  <country alpha-2="SD" name =	"Sudan (the)"/>
  <country alpha-2="SR" name =	"Suriname"/>
  <country alpha-2="SJ" name =	"Svalbard and Jan Mayen"/>
  <country alpha-2="SE" name =	"Sweden"/>
  <country alpha-2="CH" name =	"Switzerland"/>
  <country alpha-2="SY" name =	"Syrian Arab Republic"/>
  <country alpha-2="TW" name =	"Taiwan (Province of China)"/>
  <country alpha-2="TJ" name =	"Tajikistan"/>
  <country alpha-2="TZ" name =	"Tanzania, United Republic of"/>
  <country alpha-2="TH" name =	"Thailand"/>
  <country alpha-2="TL" name =	"Timor-Leste"/>
  <country alpha-2="TG" name =	"Togo"/>
  <country alpha-2="TK" name =	"Tokelau"/>
  <country alpha-2="TO" name =	"Tonga"/>
  <country alpha-2="TT" name =	"Trinidad and Tobago"/>
  <country alpha-2="TN" name =	"Tunisia"/>
  <country alpha-2="TR" name =	"Turkey"/>
  <country alpha-2="TM" name =	"Turkmenistan"/>
  <country alpha-2="TC" name =	"Turks and Caicos Islands (the)"/>
  <country alpha-2="TV" name =	"Tuvalu"/>
  <country alpha-2="UG" name =	"Uganda"/>
  <country alpha-2="UA" name =	"Ukraine"/>
  <country alpha-2="AE" name =	"United Arab Emirates (the)"/>
  <country alpha-2="GB" name =	"United Kingdom of Great Britain and Northern
Ireland (the)"/>
  <country alpha-2="UM" name =	"United States Minor Outlying Islands (the)"/>
  <country alpha-2="US" name =	"United States of America (the)"/>
  <country alpha-2="UY" name =	"Uruguay"/>
  <country alpha-2="UZ" name =	"Uzbekistan"/>
  <country alpha-2="VU" name =	"Vanuatu"/>
  <country alpha-2="VE" name =	"Venezuela (Bolivarian Republic of)"/>
  <country alpha-2="VN" name =	"Viet Nam"/>
  <country alpha-2="VG" name =	"Virgin Islands (British)"/>
  <country alpha-2="VI" name =	"Virgin Islands (U.S.)"/>
  <country alpha-2="WF" name =	"Wallis and Futuna"/>
  <country alpha-2="EH" name =	"Western Sahara"/>
  <country alpha-2="YE" name =	"Yemen"/>
  <country alpha-2="ZM" name =	"Zambia"/>
  <country alpha-2="ZW" name =	"Zimbabwe"/>
  <country alpha-2="AX" name =	"Cland Islands"/>
</codes>

-----Original Message-----
From: Dave Pawson dave.pawson@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Sunday, July 2, 2023 6:56 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [EXTERNAL]Re: [xsl] XSLT2 Change country name to alpha-2

A table / dictionary, assuming you know what you mean by 'country' and
'alpha-2'?

On Sun, 2 Jul 2023 at 11:51, LEGAULT, PHILLIP plegault@xxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Is there an way to convert country name to alpha-2?
>
>
>
>
>
> XSL-List info and archive
> EasyUnsubscribe (by email)



--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.

Current Thread