Hi Andrew,

>   'contains(.,">")',
> …
> return true, as expected.

The difference is that < and > don’t have to be encoded if they are
used in strings. You can write…

contains('', '<')

…but the following query is invalid:

contains('<', '&')

> I can get the expected result if I double-escape the entity:
> 'contains(.,"&amp;amp;")'

You can use the string constructor syntax, it’s often better readable:

xquery:eval(
  ``[contains(., "&amp;")]``,
  map { '': <foo>{ ``[&<]`` }</foo> }
)

With recent versions of BaseX, you can also use simple backticks
(that’s XQuery 4 syntax, it will be documented soon). The following
queries are equivalent:

`&`
``[&]``
"&amp;"

Hope this helps,
Christian

Reply via email to