Hi Hugh,
I understand, but did you see the details of my second attempt? The serialization controls didn’t work when specified in XQuery either.
I don’t get XPST0081 for this query (as indicated in a previous reply of mine). Could you please clarify first if the unchanged query you supplied via your first mail really fails on your machine?
If no (i.e., if it runs successfully with the declared namespace), please give us more details on how to trigger this behavior. I get the following result with both 9.0.2 and 9.1 beta when running the query of your second attempt in the BaseX GUI or on command line:
<?xml version="1.0" encoding="UTF-8"?> <rss xmlns="http://backend.userland.com/rss2" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"> content:encoded<![CDATA[hi]]></content:encoded> content:encoded<![CDATA[howdy]]></content:encoded> content:encoded<![CDATA[hello]]></content:encoded> </rss>
Could you please try what result you get if you run the query directly in the GUI or on command-line? If the result is correct, we can proceed further. If it’s already wrong, we may need to compare our BaseX configurations (in that case, we should start with a newly downloaded instance of one of our distributions).
And if the problem persists, maybe we could even simplify your example and try the following query:
declare option output:cdata-section-elements "xml"; <xml>A</xml>
Does it yield different results with BaseX 8 and 9 on your machine?
And why do the same serialization options in XQuery work in BaseX 8 but not BaseX 9?
Just to be sure: Is this already a fact (did you compare the versions by yourself), or is it still a guess?
why would I want the result to come back as an escaped string instead of real nodes?
Same here: With xquery:transform-text, or with Vincent’s query, nothing will be escaped on my machine. The result is pretty similar to the result of your second attempt, it’s only the indentation that differs slightly.
Best, Christian