November Happy Hour will be moved to Thursday December 5th.

How to use UserControlBase.Translate with same element

Vote:
 

Normally, when you need to retrieve values from relatePlusEN.xml, you use Translate

string value = Translate("/login/currentuser");

 

But what if I have this entry:

<countryselector>
<country name="UnitedStates">
<text>United States</text>
<language>en-US</language>
</country>
<country name="NewZealand">
<text>New Zealand</text>
<language>en-NZ</language>
</country>
<country name="Australia">
<text>Australia</text>
<language>en-AU</language>
</country>
</countryselector>

How can I get the text value for the UnitedStates country?

I tried Translate("/countryselector/country name=\"UnitedStates\"/text"); but it didn't work. It just returned missing value.

#53982
Sep 28, 2011 3:53
Vote:
 

Hi

Try Translate("/countryselector/country[@name=\"UnitedStates\"]/text");

Regards

Per Gunsarfs

EPiServer Development Team

#53984
Sep 28, 2011 8:47
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.