Describe the bug
a CDATA section is not added to the output for an element x when there is a serialization option as follows:
declare option output:cdata-section-elements "x";
Expected behavior
I expect the output to contain a CDATA wrapper for the elements listed in the cdata-section-elements list, wrapping the content of the element. Quoting Priscilla's book:
"cdata-section-elements
A space-separated list of qualified element names whose contents should be enclosed in a CDATA section in XML output. For example, if your Docbook output contains some escaped XML examples, the output might be written as: <programlisting><p>Example p content</p></programlisting> with escaped less-than characters. If you list the programlisting element in the cdata-section-elements parameter, the output will be more readable: <programlisting><![CDATA[<p>Example p content</p>]]></programlisting>
The output XML document is exactly equivalent; CDATA sections are merely used for convenience when editing documents."
To Reproduce
The following XQuery shows my current use case: outputting a constructed URL without escaped the &. I have played with various serialization settings but did not find any that would produce the CDATA.
This code will produce the CDATA section when run from Saxon XQuery (EE 12.3, run from Oxygen):
<?xml version="1.0" encoding="UTF-8"?><html><head><title>HTML ampersand test</title><script><![CDATA[localhost:8080/exist/apps/myapp?my1=1&my2=2]]></script></head><body><h1>TEST</h1></body></html>
but not when run from eXist-db 6.2.0.:
<html><head><title>HTML ampersand test</title><script>localhost:8080/exist/apps/myapp?my1=1&my2=2</script></head><body><h1>TEST</h1></body></html>
It seems to me that the case of adding a CDATA wrapper, as mentioned in the XQuery book, was not addressed with https://github.com/eXist-db/exist/issues/2233 but merely the preservation of previously created CDATA sections.
Pinging @adamretter and @joewiz for comments.
Describe the bug a CDATA section is not added to the output for an element
x
when there is a serialization option as follows:declare option output:cdata-section-elements "x";
Expected behavior I expect the output to contain a CDATA wrapper for the elements listed in the
cdata-section-elements
list, wrapping the content of the element. Quoting Priscilla's book: "cdata-section-elements A space-separated list of qualified element names whose contents should be enclosed in a CDATA section in XML output. For example, if your Docbook output contains some escaped XML examples, the output might be written as:<programlisting><p>Example p content</p></programlisting>
with escaped less-than characters. If you list the programlisting element in the cdata-section-elements parameter, the output will be more readable:<programlisting><![CDATA[<p>Example p content</p>]]></programlisting>
The output XML document is exactly equivalent; CDATA sections are merely used for convenience when editing documents."To Reproduce The following XQuery shows my current use case: outputting a constructed URL without escaped the &. I have played with various serialization settings but did not find any that would produce the CDATA.
This code will produce the CDATA section when run from Saxon XQuery (EE 12.3, run from Oxygen):
<?xml version="1.0" encoding="UTF-8"?><html><head><title>HTML ampersand test</title><script><![CDATA[localhost:8080/exist/apps/myapp?my1=1&my2=2]]></script></head><body><h1>TEST</h1></body></html>
but not when run from eXist-db 6.2.0.:
<html><head><title>HTML ampersand test</title><script>localhost:8080/exist/apps/myapp?my1=1&my2=2</script></head><body><h1>TEST</h1></body></html>
It seems to me that the case of adding a CDATA wrapper, as mentioned in the XQuery book, was not addressed with https://github.com/eXist-db/exist/issues/2233 but merely the preservation of previously created CDATA sections. Pinging @adamretter and @joewiz for comments.