[xquery-talk] format-number problem

Ihe Onwuka ihe.onwuka at gmail.com
Sat Oct 18 10:58:34 PDT 2014


Given a piece of data like

<movie imdbID="1000111" rtID="/m/joyjatra/"/>

I wanted to zero pad all imdbID attributes to length 7.

So i did this

<movie imdbID="1000111" rtID="/m/joyjatra/"/>/
      <movie>{
          @rtID,
          attribute imdb_id {format-number(@imdbID,'0000000')}
      }</movie>

Now it's quite possible that I asked for the wrong thing but leave that
aside for a sec. In this particular example the desired outcome is that the
data returns unchanged since it is already the requisite length.

But

in eXist  I get

<movie rtID="/m/joyjatra/" imdb_id="1.000111E6"/>

and in Zorba I get

<movie rtID="/m/joyjatra/" imdb_id="NaN"/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://x-query.com/pipermail/talk/attachments/20141018/c5f4e3b2/attachment.html>


More information about the talk mailing list