how to pass serialization params to file:write
Wednesday, 14 September 2011 · 4 messages · last reply 15 Sep 2011
RS
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
Quoted text · Kevin S. Clarke · 19 lines
On Wed, 14 Sep 2011 17:47:01 +0200, Kevin S. Clarke <ksclarke at 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 at 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/
KC
Kevin S. Clarke14 Sep 2011 19:47 #
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,
KevinCG
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.orgQuoted text · Rositsa Shadura · 50 lines
On Wed, Sep 14, 2011 at 6:26 PM, Rositsa Shadura <rositsa.shadura at 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 at 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 at 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 at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
KC
Kevin S. Clarke15 Sep 2011 05:40 #
Thanks Christian and Rosi! The map alternative looks nice and clean... I'll go that route.
Kevin
Quoted text · Christian Grün · 83 lines
On Wed, Sep 14, 2011 at 5:40 PM, Christian Grün <christian.gruen at 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 at 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 at 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 at 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 at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >
Written for BaseX 6.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery