restxq output cdata-section-elements

Thursday, 1 June 2017 · 3 messages
MG
Maximilian Gärber1 Jun 2017 23:19 #
Hi, when setting %output:cdata-section-elements("KSP DESCRIPTION") on a restxq request, I get
   <DESCRIPTION><![CDATA[
                  ]]><p>Zur Aktivierung des...</p><![CDATA[
                  ]]><ul>
                     <li>außerordentlich hoher Biotingehalt (3
Millionen µg pro kg)</li>
                     <li>gut bioverfügbares Zinksulfat</li>
                     <li>ausgewogenes Biotin-Zink-Verhältnis</li>
                  </ul><![CDATA[
                  ]]><p>
I would expect everything inside the DESCRIPTION element to be part of CDATA. But CDATA ends before the first child element This happens with Basex 8.5.2 Br, Max
MH
Martin Honnen1 Jun 2017 23:24 #
Quoted text · Maximilian Gärber · 24 lines
Am 01.06.2017 um 23:19 schrieb Maximilian Gärber: > Hi, > > when setting > > %output:cdata-section-elements("KSP DESCRIPTION") > > on a restxq request, I get > > > <DESCRIPTION><![CDATA[ > ]]><p>Zur Aktivierung des...</p><![CDATA[ > ]]><ul> > <li>außerordentlich hoher Biotingehalt (3 > Millionen µg pro kg)</li> > <li>gut bioverfügbares Zinksulfat</li> > <li>ausgewogenes Biotin-Zink-Verhältnis</li> > </ul><![CDATA[ > ]]><p> > > > I would expect everything inside the DESCRIPTION element to be part of > CDATA. But CDATA ends before the first child element >
You would need to make sure the element contains text content, for instance by serializing the child elements first with the XPath/XQuery 3.0 serialize function.
MG
Maximilian Gärberin reply to Maximilian Gärber, 1 Jun 2017, 23:191 Jun 2017 23:30 #
It works, however, if I wrap the elements with the serialize() function when constructing the output So: ... <KSP>{serialize($ksp)}</KSP> .... will result in (while still declaring %output:cdata-section-elements)
<KSP><![CDATA[
                  <ul>
                     <li>mild und gut verträglich</li>
                     <li>gut geeignet als Abgabeprodukt</li>
                     <li>0 ...</li>
                  </ul>
                  <p> </p>
                  <p>.. ist auch als <strong>Essigsaure
Tonerde</strong> bekannt, ... als <strong>Alaun</strong>.</p>
               ]]></KSP>
2017-06-01 23:19 GMT+02:00 Maximilian Gärber <mgaerber at arcor.de>:
Quoted text · Maximilian Gärber · 27 lines
> Hi, > > when setting > > %output:cdata-section-elements("KSP DESCRIPTION") > > on a restxq request, I get > > > <DESCRIPTION><![CDATA[ > ]]><p>Zur Aktivierung des...</p><![CDATA[ > ]]><ul> > <li>außerordentlich hoher Biotingehalt (3 > Millionen µg pro kg)</li> > <li>gut bioverfügbares Zinksulfat</li> > <li>ausgewogenes Biotin-Zink-Verhältnis</li> > </ul><![CDATA[ > ]]><p> > > > I would expect everything inside the DESCRIPTION element to be part of > CDATA. But CDATA ends before the first child element > > This happens with Basex 8.5.2 > > > Br, Max

⚡Generated with XQuery