how to pass serialization params to file:write
Hi, I'm having difficulty locating the proper syntax to pass to file:write(). The documentation says: $serializer-params as node()* but what does that element look like? <output method="text"/> or <serialization method="text"/> or <serialization method="xml" cdata-section-elements="div"/> or something else? I see I can set those as options in the XQuery itself too, but I'd like to figure out what I'm doing wrong. Thanks, Kevin
Hi Kevin, you can specify the serialization parameters either on the following way: <serialization-parameters xmlns="http://www.w3.org/2010/xslt-xquery-serialization"> <method value="xml"/> <version value="1.0"/> <cdata-section-elements value="div"/> </serialization-parameters> or using the map structure: let $params := map { "method" := "xml", "cdata-section-elements" := "div" } Regards, Rositsa On Wed, 14 Sep 2011 17:47:01 +0200, Kevin S. Clarke <ksclarke@gmail.com> wrote:
Hi,
I'm having difficulty locating the proper syntax to pass to file:write(). The documentation says: $serializer-params as node()*
but what does that element look like? <output method="text"/> or <serialization method="text"/> or <serialization method="xml" cdata-section-elements="div"/> or something else? I see I can set those as options in the XQuery itself too, but I'd like to figure out what I'm doing wrong.
Thanks, Kevin _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
-- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Dear Kevin, Rosi was so kind to extend our Wiki and add examples for the file:write() function: http://docs.basex.org/wiki/File_Functions#file:write I noticed a minor incompatibility with the latest XQuery Serialization specification: in BaseX 6.7.1, the values of serialization parameters were specified as text nodes of the parameter elements, whereas the latest specs tells you to put values in a "value" attribute. This issue has been fixed in the latest stable snapshot (and in the git repository): http://files.basex.org/releases/latest/ Please note that the preferred map alternative works with both releases. Hope this helps, have fun, Christian ___________________________ BaseX Team Christian Grün Uni KN, Box 188 D-78457 Konstanz http://www.basex.org On Wed, Sep 14, 2011 at 6:26 PM, Rositsa Shadura <rositsa.shadura@uni-konstanz.de> wrote:
Hi Kevin,
you can specify the serialization parameters either on the following way:
<serialization-parameters xmlns="http://www.w3.org/2010/xslt-xquery-serialization"> <method value="xml"/> <version value="1.0"/> <cdata-section-elements value="div"/> </serialization-parameters>
or using the map structure:
let $params := map { "method" := "xml", "cdata-section-elements" := "div" }
Regards, Rositsa
On Wed, 14 Sep 2011 17:47:01 +0200, Kevin S. Clarke <ksclarke@gmail.com> wrote:
Hi,
I'm having difficulty locating the proper syntax to pass to file:write(). The documentation says: $serializer-params as node()*
but what does that element look like? <output method="text"/> or <serialization method="text"/> or <serialization method="xml" cdata-section-elements="div"/> or something else? I see I can set those as options in the XQuery itself too, but I'd like to figure out what I'm doing wrong.
Thanks, Kevin _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
-- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Thanks Christian and Rosi! The map alternative looks nice and clean... I'll go that route. Kevin On Wed, Sep 14, 2011 at 5:40 PM, Christian Grün <christian.gruen@gmail.com> wrote:
Dear Kevin,
Rosi was so kind to extend our Wiki and add examples for the file:write() function:
http://docs.basex.org/wiki/File_Functions#file:write
I noticed a minor incompatibility with the latest XQuery Serialization specification: in BaseX 6.7.1, the values of serialization parameters were specified as text nodes of the parameter elements, whereas the latest specs tells you to put values in a "value" attribute. This issue has been fixed in the latest stable snapshot (and in the git repository):
http://files.basex.org/releases/latest/
Please note that the preferred map alternative works with both releases.
Hope this helps, have fun, Christian ___________________________
BaseX Team Christian Grün Uni KN, Box 188 D-78457 Konstanz http://www.basex.org
On Wed, Sep 14, 2011 at 6:26 PM, Rositsa Shadura <rositsa.shadura@uni-konstanz.de> wrote:
Hi Kevin,
you can specify the serialization parameters either on the following way:
<serialization-parameters xmlns="http://www.w3.org/2010/xslt-xquery-serialization"> <method value="xml"/> <version value="1.0"/> <cdata-section-elements value="div"/> </serialization-parameters>
or using the map structure:
let $params := map { "method" := "xml", "cdata-section-elements" := "div" }
Regards, Rositsa
On Wed, 14 Sep 2011 17:47:01 +0200, Kevin S. Clarke <ksclarke@gmail.com> wrote:
Hi,
I'm having difficulty locating the proper syntax to pass to file:write(). The documentation says: $serializer-params as node()*
but what does that element look like? <output method="text"/> or <serialization method="text"/> or <serialization method="xml" cdata-section-elements="div"/> or something else? I see I can set those as options in the XQuery itself too, but I'd like to figure out what I'm doing wrong.
Thanks, Kevin _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
-- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
participants (3)
-
Christian Grün -
Kevin S. Clarke -
Rositsa Shadura