Output `out:format` function question
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
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.
Marco - On Mon, Oct 8, 2018 at 3:24 AM Marco Lettere <m.lettere@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!
Regards,
Marco.
Best, Bridger
participants (2)
-
Bridger Dyson-Smith -
Marco Lettere