Subject: RE: [xsl] Error when params are in Xpath expression From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 12 May 2009 20:00:53 +0100 |
> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Error when params are in , Wendell Piez | Thread | Re: [xsl] Error when params are in , Florent Georges |
Re: [xsl] Error when params are in , Wendell Piez | Date | Re: [xsl] Error when params are in , Florent Georges |
Month |