constraint
duplicate
query
xpath
Jahia 7.3
Jahia 8
XPath query returns duplicate entry
Question
Some XPath query returns duplicate entry. here is an example of such query
//element(*,jmix:editorialContent)
Is there a way to get unique nodes?
Answer
To prevent duplicate entries, you need to add a language constraint. So the query is returning the main node and the translation node. Here is what you could do
- if you add
and not(@jcr
:language
)
will return just the main nodes - Or add
and @jcr
:language
= 'en'
will return just the nodes translated to English
You could also switch to SQL-2, then the duplicate is filtered automatically .