Discussion:
[xquery-talk] format-number problem
Ihe Onwuka
2014-10-18 17:58:34 UTC
Permalink
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"/>
Christian Grün
2014-10-18 18:18:49 UTC
Permalink
Post by Ihe Onwuka
<movie imdbID="1000111" rtID="/m/joyjatra/"/>/
<movie>{
@rtID,
}</movie>
I tried to other processors, and the result I got was…

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

…so I looks more an implementation issue.

Best,
Christian

Continue reading on narkive:
Loading...