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

Re: Need help with using lookup table and string tran

Subject: Re: Need help with using lookup table and string translation
From: Dmitri Snytkine <d.snytkine@xxxxxxxxx>
Date: Mon, 11 May 2009 15:40:18 -0400
Re:  Need help with using lookup table and string  tran
The 'for in' looks like xslt2 function.
I MUST do this with XSLT 1
This is important because its for a browser-based transformations and
I need the template to work on most browsers.

That's why I have not even looked at all the XSLT2 functions yet.

At fist I thought about using named template and use call-template but
now I think it's not necessary and I can just create a normal template
for the <trs> element

and inside that template do all the logic of finding the correct
result for the value of the element.

On Mon, May 11, 2009 at 9:57 AM, Andrew Welch <andrew.j.welch@xxxxxxxxx>
>> You need a template that matches all <trs> elements
>> In that template select the text node and store the text value in a
variable. lets call it $key
>> then select /trans/tr_string[@str=$key]/ru/text()
>> if it isnot empty return it otherwise select the en version.
>> this can be done with a if then else expression
> I'd be tempted to do
> <xsl:key name="tr_string-by-str" match="tr_string" use="@str"/>
> with something like:
> for $x in key('tr_string-by-str', $key) return (x$/ru, $x/en, .)[1]
> --
> Andrew Welch
> http://andrewjwelch.com
> Kernow: http://kernowforsaxon.sf.net/

Current Thread


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.
First Name
Last Name
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.