[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Aw: Re: XSLT2 Change country name to alpha-2

Subject: Re: Aw: Re: XSLT2 Change country name to alpha-2
From: "LEGAULT, PHILLIP plegault@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 3 Jul 2023 10:59:12 -0000
Re: Aw: Re:  XSLT2 Change country name to  alpha-2
Yes, that and I forgot to declare the variable.

Thanks for the help

From: Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, July 3, 2023 1:46 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [EXTERNAL]Aw: Re:  XSLT2 Change country name to alpha-2

The second argument to the key function is an XPath expression, remove the
single quote delimiters you have in your code.

--
Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.
Am 03.07.23, 02:45 schrieb "LEGAULT, PHILLIP
plegault@xxxxxxxxxx<mailto:plegault@xxxxxxxxxx>"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx
rytech.com>>:
Tried it like this:

<codes>

<country alpha-2="US" name = "United States"/>

</codes>

<xsl:key name="alpha-by-name" match="codes/country" use="@name"/>

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<primarysourcecountry><xsl:value-of select="key('alpha-by-name',
'/records/sf:ConsumerCountry_GCC__c',
$codes)/@alpha-2"/></primarysourcecountry>



Does not work.







-----Original Message-----

From: Martin Honnen martin.honnen@xxxxxx<mailto:martin.honnen@xxxxxx>
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx
rytech.com>>

Sent: Sunday, July 2, 2023 7:20 AM

To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list@xxxxxxxxxxxxxxxxxxxxxx>

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





On 02.07.2023 13:09, LEGAULT, PHILLIP
plegault@xxxxxxxxxx<mailto:plegault@xxxxxxxxxx> wrote:

> I get the country in like United States.

>

>

>

> I have this,





Then declare a key



  <xsl:key name="alpha-by-name" match="codes/country" use="@name"/>





load e.g. <xsl:param name="codes" select="doc('codes.xml')"/> and where you
need the code from the country name use e.g.



  key('alpha-by-name', country, $codes)/@alpha-2





I wonder how often that will fail for e.g.



>

> <codes>

>

>

>

> <country alpha-2="BS" name = "Bahamas (the)"/>

>

>

or

>

> <country alpha-2="IO" name = "British Indian Ocean Territory (the)"/>

>

>

or

>

> <country alpha-2="KY" name = "Cayman Islands (the)"/>

>

>






XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/3514465> (by
email<>)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.