concat
adds another double quote if an input string includes one.
I am using XQuery 3.1 on eXide. A̶F̶A̶I̶K̶,̶ ̶e̶X̶i̶d̶e̶ ̶u̶s̶e̶s̶ ̶S̶a̶x̶o̶n̶ ̶a̶s̶ ̶X̶Q̶u̶e̶r̶y̶ ̶e̶n̶g̶i̶n̶e̶.̶ (it doesn't, see joewiz answer below).
The bug occurs when I evaluate concatenated strings.
return concat("'", 'bar')
evaluates to 'bar
which is expected.
return concat('"', 'bar')
evaluates to ""bar
.
How comes? I thought there was no difference between single and double quotes in xquery.
Here's my script:
xquery version "3.1";
let $c := concat('"','car')
return $c
By default, eXide serializes query results using the standard adaptive output method. Since the
concat()
function returns a string, adaptive output wraps the strings in double quotes and escapes any double quotes within the string by doubling them. This explains the phenomenon you are seeing.From the W3C spec linked above:
If you would instead like to see your results without any such quote escaping, you can use the dropdown menu just above eXide's query output pane and select "Text Method" or "XML Method" instead.
eXide's documentation (viewable via Help > Documentation) explains its serialization feature and default setting as follows:
Finally, I should note that eXist has its own native XQuery engine, and eXide passes queries directly to eXist for execution, not to Saxon. eXist uses Saxon solely for XSLT - i.e., when you use the
transform
module to invoke an XSLT from XQuery.