I am performing an XPath query in Adobe CRX and I am trying to find a list of nodes that contains the string 'Xbox Live'. What I am getting back are nodes that contain both 'Xbox' and 'Live'. I am wondering what would the query be to get an exact match of my string.
Current XPath Query: /jcr:root/content//*[jcr:contains(., 'Xbox Live')] order by @jcr:score
Example of content that I want returned:
- This offer requires an Xbox Live account
- Your Xbox Live user name is not valid
- XBox Live is the future!
Example of content that I do not want returned:
- Xbox and Playstation will live forever
- Will I live longer then my Xbox?
- The Xbox out lived my Wii
Your xpath/xquery is fine, that should return elements containing exact phrase
"Xbox Live", assuming Adobe CRX has decent xpath 1.0 implementation.Possible catch is, by using
.incontains()concatenation of all descendant text nodes will be evaluated. For example, the followingparentelement also considered matched thecontains(., 'Xbox Live')predicate :If you want to evaluate
contains()to individual text nodes, and return parent element of matched text nodes, try the following instead :