Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Search in the value of an XML field [Thread Next] Re: Search in the value of an XML fieldTo: NULL Date: 5/2/2006 2:20:00 PM Actually you do not need to specify all the character mappings, just the related part is enough. translate() willl translate only characters you provided and translate the other characters to themselves. Also Bogdan's translate() usage is correct (you do not need to spell transmission in translate() table :) ). -- Sih Huseyin Ulger [MSFT] MSXML Dev "Neil Smith [MVP Digital Media]" wrote: > On 1 May 2006 16:39:50 -0700, "Bogdan Zamfir" <bzamfir@g...> > wrote: > > >Thanks, > >I found that in help, and tryed to perform a case-insensitive search > > > >I want to find a node in a xml document using xpath > > > >The doc can contains the following text > ><optionname>Transmission: automatic</optionname> > >or > ><optionname>transmission: automatic</optionname> > >or something else, but transmission word is in the field anyway > > > >But I don't know the cases of transmission word > > > >So I want to perform a case-insensitive search, so I use a xpath > >expresion like this > > > >//optionname[contains(translate(., 'transmion', > >'TRANSMION'),'TRANSMISSION')] > > > That won't match. > > You need a list of letters to translate to upper-case, as in the > documentation for translate() function (which is widely available) > > You'd need to do : > > //optionname[contains(translate( . , 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' , > 'abcdefghijklmnopqrstuvwxyz'), 'transmission')] > > Also, Transmission is incorrectly spelled, but that's not important > right now (it will never match if you can't spell it as it is in the > data). > > As others have said, do you see how much work is being made because > the data schema is deeply broken and unnecessarily hard to work with ? > I would insist the data provider uses a schema more like : > > <option> > <name>TRANSMISSION</name> > <type>AUTOMATIC</name> > </option> > > HTH > Cheers - Neil > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
