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)) Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format