I'm not 100% sure why your statement doesn't work but I'll take a shot based on what's written in JSR 170 spec (the java repository spec).
The spec seems to imply using jcr:contains is only required to work against a node as opposed to an attribute. For example, //*[jcr:contains( '.', 'Ho' )] would work but would search the entire node for the string 'Ho'. You could replace jcr:contains with jcr:like and it should work the way you expect: //*[jcr:like( @title, '%Ho%' )] --David Hussain, S (Saqib) wrote: > Hi Will, > > Sorry one more thing: > > > I have got node name called "title" whose value is "Company Home". As > you sent me following xpath query that is. > > > //element(*, mgnl:content)[jcr:contains(@title, 'Home')] > > It works fine. But, when I run like following: > > //element(*, mgnl:content)[jcr:contains(@title, 'Ho')] > > Then it doesn't work I mean how can I find a part of string in node > value. Hope you understand. > > Thanks in advance. I will really appreciate your help. > > Saqib. > > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] > Sent: 11 November 2008 16:16 > To: [email protected] > Subject: Re: [magnolia-user] (XPATH) JCR Query Help > > Sorry, I forgot something. You asked about "contains". Here we go: > > //element(*, mgnl:content)[jcr:contains(@title, 'Home')] > > On 11.11.2008, at 17:13, Will Scheidegger wrote: > > >> Ah... now we've got a question that can actually be answered! ;-) JCR >> XPath is sometimes a bit special. Try this: >> >> //element(*, mgnl:content)[EMAIL PROTECTED] = 'Home'] >> >> This tool here helps converting JCR XPath queries to SQL queries and >> back. Can be very helpful sometimes: >> http://people.apache.org/~mreutegg/jcr-query-translator/ >> translator.html >> >> - will >> >> On 11.11.2008, at 16:43, Hussain, S (Saqib) wrote: >> >> >>> Hi , >>> >>> I am trying to run the following Xpath query but it doesn't not >>> return any result. >>> >>> //*[contains(@title,'Home')] >>> >>> BUT If I don't use contains then the following Xpath query returns >>> result. >>> >>> //[EMAIL PROTECTED] = 'Home'] >>> >>> Please, Any suggestions that why contains function not working >>> (//*[contains(@title,'Home')] ). >>> >>> >>> Thanks. >>> >>> Saqib. >>> >>> >>> >>> -----Original Message----- >>> From: [email protected] [mailto:[EMAIL PROTECTED] >>> Sent: 11 November 2008 15:07 >>> To: [email protected] >>> Subject: Re: [magnolia-user] (XPATH) JCR Query Help >>> >>> http://www.google.com/search?client=safari&rls=en-us&q=xpath+tutorial >>> &ie >>> =UTF-8&oe=UTF-8 >>> >>> Thanks >>> >>> will >>> >>> On 11.11.2008, at 16:02, Hussain, S (Saqib) wrote: >>> >>> >>>> Hi All, >>>> >>>> I need to find out all those nodes (JCR Browser Path) that contains >>>> particular value. >>>> >>>> Thanks. >>>> >>>> Saqib. >>>> <DIV><FONT size="1" color="gray">This e-mail and any attachments may >>>> > > >>>> contain confidential, copyright and or privileged material, and are >>>> for the use of the intended addressee only. If you are not the >>>> intended addressee or an authorised recipient of the addressee >>>> please notify us of receipt by returning the e-mail and do not use, >>>> copy, retain, distribute or disclose the information in or attached >>>> to the e-mail. >>>> Any opinions expressed within this e-mail are those of the >>>> individual and not necessarily of Diamond Light Source Ltd. >>>> Diamond Light Source Ltd. cannot guarantee that this e-mail or any >>>> attachments are free from viruses and we cannot accept liability for >>>> > > >>>> any damage which you may sustain as a result of software viruses >>>> which >>>> >>>> may be transmitted in or with the message. >>>> Diamond Light Source Limited (company no. 4375679). Registered in >>>> England and Wales with its registered office at Diamond House, >>>> Harwell >>>> >>>> Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United >>>> > > >>>> Kingdom </FONT></DIV> >>>> -- >>>> Scanned by iCritical. >>>> >>>> ---------------------------------------------------------------- >>>> for list details see >>>> http://www.magnolia-cms.com/home/community/mailing-lists.html >>>> ---------------------------------------------------------------- >>>> >>> ---------------------------------------------------------------- >>> for list details see >>> http://www.magnolia-cms.com/home/community/mailing-lists.html >>> ---------------------------------------------------------------- >>> <DIV><FONT size="1" color="gray">This e-mail and any attachments may >>> contain confidential, copyright and or privileged material, and are >>> for the use of the intended addressee only. If you are not the >>> intended addressee or an authorised recipient of the addressee please >>> > > >>> notify us of receipt by returning the e-mail and do not use, copy, >>> retain, distribute or disclose the information in or attached to the >>> e-mail. >>> Any opinions expressed within this e-mail are those of the individual >>> > > >>> and not necessarily of Diamond Light Source Ltd. >>> Diamond Light Source Ltd. cannot guarantee that this e-mail or any >>> attachments are free from viruses and we cannot accept liability for >>> any damage which you may sustain as a result of software viruses >>> which may be transmitted in or with the message. >>> Diamond Light Source Limited (company no. 4375679). Registered in >>> England and Wales with its registered office at Diamond House, >>> Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, >>> > > >>> United Kingdom </FONT></DIV> >>> -- >>> Scanned by iCritical. >>> >>> ---------------------------------------------------------------- >>> for list details see >>> http://www.magnolia-cms.com/home/community/mailing-lists.html >>> ---------------------------------------------------------------- >>> >> ---------------------------------------------------------------- >> for list details see >> http://www.magnolia-cms.com/home/community/mailing-lists.html >> ---------------------------------------------------------------- >> > > > ---------------------------------------------------------------- > for list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > ---------------------------------------------------------------- > <DIV><FONT size="1" color="gray">This e-mail and any attachments may contain > confidential, copyright and or privileged material, and are for the use of > the intended addressee only. If you are not the intended addressee or an > authorised recipient of the addressee please notify us of receipt by > returning the e-mail and do not use, copy, retain, distribute or disclose the > information in or attached to the e-mail. > Any opinions expressed within this e-mail are those of the individual and not > necessarily of Diamond Light Source Ltd. > Diamond Light Source Ltd. cannot guarantee that this e-mail or any > attachments are free from viruses and we cannot accept liability for any > damage which you may sustain as a result of software viruses which may be > transmitted in or with the message. > Diamond Light Source Limited (company no. 4375679). Registered in England and > Wales with its registered office at Diamond House, Harwell Science and > Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom > </FONT></DIV> > ---------------------------------------------------------------- for list details see http://www.magnolia-cms.com/home/community/mailing-lists.html ----------------------------------------------------------------
