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

RE: Error when params are in Xpath expression

Subject: RE: Error when params are in Xpath expression
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 12 May 2009 20:00:53 +0100
RE:  Error when params are in Xpath expression
> Actually, I think now you have
> document('')/*/trans:tr/tr_string[@str=$str]/*[name()=$toLang]"
> Note the slight alteration in the predicate in the last step.
> >Then there is a question of which format would be faster for 
> Xpath to 
> >test to see if string exists in a desired language?
> Beats me. I think examining the @lang attribute might be a 
> tiny bit faster than using the name() function. I doubt the 
> difference would be noticeable unless documents got very large.

Assuming you have 5000 strings in 5 languages, the cost of finding the right
language is going to be negligible compared with finding the right string.
But it might well be worth keying the strings on the combination of the two:

<xsl:key name="k"  match="tr_string/*" use="concat(../@str, '#', @lang)"/>

and then replace the above path with:

key('k', concat($str, '#', $toLang))


Michael Kay

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.