BaseX-12.1: HTML 5.0 serialization difference

Wednesday, 4 February 2026 · 3 messages · last reply 5 Feb 2026
R
ron.vdbranden4 Feb 2026 18:05 #
Hi, I've noticed a serialization difference since updating to BaseX-12.1, and am wondering if this is intentional or not. When serializing as HTML 5.0, the character escaping in <script> tags seems to be influenced by the presence of preceding <script> tags that are either empty or only contain collapsible whitespace: * when a <script> element follows a non-empty (or non-collapsible) <script> element, special characters like &, <, and > are unescaped in the output o input:
        <head>
           <script><![CDATA[& < > ]]></script>
           <script src="test">//</script>
           <script>&amp; &lt; &gt;</script>
        </head>
        ! serialize(., map {"method":"html", "version":"5.0"})
o output:
        <head>
           <meta charset="UTF-8">
           <script>& < > </script>
           <script src="test">//</script>
           <script>& < ></script>
        </head>
* when, however, a <script> element follows an empty (or collapsible) <script> element, special characters like &, <, and > are escaped in the output o input:
        <head>
           <script><![CDATA[& < > ]]></script>
           *<script src="test"></script>*
           <script>&amp; &lt; &gt;</script>
        </head>
        ! serialize(., map {"method":"html", "version":"5.0"})
o output:
        <head>
           <meta charset="UTF-8">
           <script>& < > </script>
           <script src="test">//</script>
           <script>*&amp; &lt; &gt;*</script>
        </head>
I'm wondering if this is intentional or a bug? Best, Ron
CG
Christian Grün4 Feb 2026 18:34 #
Hi Ron, Thanks for the detailed bug report. I am glad to report back that it has already been fixed in our latest 12.2 release [1,2]. Cheers, Christian [1] https://github.com/BaseXdb/basex/issues/2575 [2] https://basex.org/download/
Quoted text · ron.vdbranden · 44 lines
Von: ron.vdbranden--- via BaseX-Talk <basex-talk at mailman.uni-konstanz.de> Gesendet: Mittwoch, 4. Februar 2026 18:05 An: BaseX <basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] BaseX-12.1: HTML 5.0 serialization difference Hi, I've noticed a serialization difference since updating to BaseX-12.1, and am wondering if this is intentional or not. When serializing as HTML 5.0, the character escaping in <script> tags seems to be influenced by the presence of preceding <script> tags that are either empty or only contain collapsible whitespace: * when a <script> element follows a non-empty (or non-collapsible) <script> element, special characters like &, <, and > are unescaped in the output * input: <head> <script><![CDATA[& < > ]]></script> <script src="test">//</script> <script>&amp; &lt; &gt;</script> </head> ! serialize(., map {"method":"html", "version":"5.0"}) * output: <head> <meta charset="UTF-8"> <script>& < > </script> <script src="test">//</script> <script>& < ></script> </head> * when, however, a <script> element follows an empty (or collapsible) <script> element, special characters like &, <, and > are escaped in the output * input: <head> <script><![CDATA[& < > ]]></script> <script src="test"></script> <script>&amp; &lt; &gt;</script> </head> ! serialize(., map {"method":"html", "version":"5.0"}) * output: <head> <meta charset="UTF-8"> <script>& < > </script> <script src="test">//</script> <script>&amp; &lt; &gt;</script> </head> I'm wondering if this is intentional or a bug? Best, Ron
R
ron.vdbranden5 Feb 2026 09:17 #
Hi Christian, Wonderful, many thanks! Works perfectly in 12.2, of course. And apologies for the noise, I hadn't even realised I was already one version behind... Best, Ron
Quoted text · Christian Grün · 60 lines
On 04/02/2026 18:34, Christian Grün wrote: > Hi Ron, > > Thanks for the detailed bug report. I am glad to report back that it > has already been fixed in our latest 12.2 release [1,2]. > > Cheers, > Christian > > [1] https://github.com/BaseXdb/basex/issues/2575 > [2] https://basex.org/download/ > > ------------------------------------------------------------------------ > *Von:* ron.vdbranden--- via BaseX-Talk > <basex-talk at mailman.uni-konstanz.de> > *Gesendet:* Mittwoch, 4. Februar 2026 18:05 > *An:* BaseX <basex-talk at mailman.uni-konstanz.de> > *Betreff:* [basex-talk] BaseX-12.1: HTML 5.0 serialization difference > > Hi, > > I've noticed a serialization difference since updating to BaseX-12.1, > and am wondering if this is intentional or not. > > When serializing as HTML 5.0, the character escaping in <script> tags > seems to be influenced by the presence of preceding <script> tags that > are either empty or only contain collapsible whitespace: > > * when a <script> element follows a non-empty (or non-collapsible) > <script> element, special characters like &, <, and > are > unescaped in the output > o > input: > <head> <script><![CDATA[& < > ]]></script> <script > src="test">//</script> <script>&amp; &lt; &gt;</script> > </head> ! serialize(., map {"method":"html", "version":"5.0"}) > o > output: > <head> <meta charset="UTF-8"> <script>& < > </script> > <script src="test">//</script> <script>& < ></script> </head> > * when, however, a <script> element follows an empty (or > collapsible) <script> element, special characters like &, <, and > > are escaped in the output > o > input: > <head> <script><![CDATA[& < > ]]></script> *<script > src="test"></script>* <script>&amp; &lt; &gt;</script> > </head> ! serialize(., map {"method":"html", "version":"5.0"}) > o > output: > <head> <meta charset="UTF-8"> <script>& < > </script> > <script src="test">//</script> <script>*&amp; &lt; > &gt;*</script> </head> > > I'm wondering if this is intentional or a bug? > > Best, > > Ron >

⚡Generated with XQuery