Actually, I think now you have
document('')/*/trans:tr/tr_string[(_at_)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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--