Output `out:format` function question

Monday, 8 October 2018 · 3 messages
BD
Bridger Dyson-Smith8 Oct 2018 04:39 #
Hi all - I'm confused about some notation in the out:format[1] signature. In the wiki, I see
out:format($format as xs:string, $item1 as item(), ...) as xs:string
and in v9.0.2 (and the latest v9.1 beta) GUI, I see the following info:
out:format(format,item1[,...])

But I'm confused by the `[,...]`. What does this mean? I've tried the
following:
out:format("%06d", 256) -> 000256 (: stolen from the wiki :)
out:format("%06d", 256, 367) -> 000256 (: the second item() is ignored :)
let $n := <t><i>256</i></t>
out:format("%06d", $n) -> IllegalFormatConversionException:
java.util.IllegalFormatConversionException: d != java.lang.String.
I'm weak on my data model types for sure, but how should the signature here be interpreted? Thanks for your help! Best, Bridger [1] http://docs.basex.org/wiki/Output_Module#out:format
ML
Marco Lettere8 Oct 2018 09:24 #
Quoted text · Bridger Dyson-Smith · 2 lines
On 08/10/2018 02:39, Bridger Dyson-Smith wrote: > out:format("%06d", 256, 367) -> 000256 (: the second item() is ignored :)
Hi Dyson, as far as I understand regarding this example the number of handled items depends on the format string.
out:format("%06d %06d", 256, 367)
would probably output what you expect. Regards, Marco.
BD
Bridger Dyson-Smith8 Oct 2018 17:26 #
Marco -
Quoted text · Bridger Dyson-Smith · 14 lines
On Mon, Oct 8, 2018 at 3:24 AM Marco Lettere <m.lettere at gmail.com> wrote: > On 08/10/2018 02:39, Bridger Dyson-Smith wrote: > > out:format("%06d", 256, 367) -> 000256 (: the second item() is ignored :) > > Hi Dyson, > > as far as I understand regarding this example the number of handled items > depends on the format string. > > out:format("%06d %06d", 256, 367) > > would probably output what you expect. >
It absolutely does - thank you for the helpful clarification!
Quoted text · Marco Lettere · 4 lines
> Regards, > > Marco. >
Best, Bridger

⚡Generated with XQuery