# Saturday, April 23, 2016

Some time you may need to wrap text node in a CDATA section as part of your XQuery development. For example say you need to generate the following document

<?xml version="1.0" encoding="UTF-8"?>
<sf:Resource xmlns:sf="http://www.canadapost.ca/smartflow" contentID="PAYMENT">
            <total-due>bar</total-due>             <due-date>bar</due-date>         </payment-data> ]]></sf:Resource>

The following query makes use of a processor specific XQuery option called ddtek:serialize 

Notice the syntax to define an expanded QName with namespace is { {uri} local-name }  which is different from what is erroneously described in the XQuery Tips & Tricks 

The second takeaway is how the content inside sf:Resource needs to be escaped text to produce the required result

declare namespace sf="http://www.canadapost.ca/smartflow";
declare option ddtek:serialize "omit-xml-declaration=no,encoding=UTF-8,indent=yes,cdata-section-elements={{http://www.canadapost.ca/smartflow}Resource}";
declare variable $foo := "bar";
<sf:Resource contentID="PAYMENT">
       &lt;account-number&gt;{ $foo }&lt;/account-number&gt;
       &lt;total-due&gt;{ $foo }&lt;/total-due&gt;
       &lt;due-date&gt;{ $foo }&lt;/due-date&gt;

Multiple CDATA sections are declared using ; as separator


posted on Saturday, April 23, 2016 5:58:32 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Wednesday, August 26, 2015
Acrobat Reader Error
posted on Wednesday, August 26, 2015 3:41:54 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Monday, August 17, 2015
Save 25% on Stylus Studio

Hey there,

Ryan Andrews from the Stylus Studio team here. I wanted to send you a quick email and let you know about a "Super Summer Sale" we are currently running for users who recently downloaded a free trial of Stylus Studio - the advanced XML Integrated Development Environment (XML IDE).

This offer gets you 25% Off on Stylus Studio Licenses and AUP. All you have to do is click one of the links below to buy, or use the code - Summer25 - on the online store at www.stylusstudio.com. This offer expires August 28th.

Stylus Studio X15 Release 2 Enterprise Suite
Save 25% Now »

Stylus Studio X15 Release 2 Professional Suite
Save 25% Now »

Please email me if you have any questions or would like to take advantage of this special, limited-time offer.


Ryan Andrews
Stylus Studio Team

Offer valid on new, full, standard priced licenses of Stylus Studio X15 Release 2 Professional and Enterprise Edition. Discount on AUP only valid when purchased with new licenses of Stylus Studio on the Stylus Studio online store. This offer cannot be combined with any other offer. Offer only valid on Stylus Studio online store.

posted on Monday, August 17, 2015 9:37:52 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback