We have xml like this
<paper>
<title>blue</title>
<description>red and blue</description>
<headline>red color pen</headline>
<elm1>
<term>abc</term>
</elm1>
<elm2>
<term>abc</term>
<elm2>
</paper>
We want to run Marklogic query with full document where we want to highlight word "red"
used search:search to get data, then we are calling cts:highlight to highlight word "red" in xml
it works fine
Now i want to search only in specific element i.e. description, it should highlight "red" only in description element, how to implement this?
Either wrap your current query in cts:element-query
:
cts:element-query(xs:QName('description'), cts:word-query('red'))
or use cts:element-word-query
:
cts:element-word-query(xs:QName('description'),'red')