You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by Luca Clementi <l....@cineca.it> on 2007/06/21 18:15:54 UTC
Problems while coping integer values
Hi all,
I am trying to copy an integer value in an attribute with the following
copy:
<copy>
<from>$counterParam</from>
<to>$n0_PAAM_data_in.body/xsd:parameterSet/@id</to>
</copy>
Where
<variable messageType="xsd:paamInput" name="n0_PAAM_data_in" />
<variable name="counterParam" type="xs:integer" />
and paamInput schema declares the attribute with a:
<xsd:attribute name="id" type="xsd:integer" use="optional"/>
The problem is that final result is:
<?xml version="1.0" encoding="UTF-8"?>
<PAAM_in xmlns="http://www.a-ware.org/test/xsd"
xmlns:xsd="http://www.a-ware.org/test/xsd">
<templateFile>pluto</templateFile>
<parameterSet id="1.0"> <----------
<xsd:parameter>
<xsd:name>string1</xsd:name>
<xsd:value>string1</xsd:value>
</xsd:parameter>
</parameterSet>
</PAAM_in>
While before the copy it was:
<parameterSet id="1">
Obviously the final message is invalid because the field that should be
an integer, is represented with a dot.
Is this a bug or am I doing something wrong?
thanks for your help,
Luca
Re: Problems while coping integer values
Posted by Luca Clementi <l....@cineca.it>.
Alex Boisvert wrote:
> Hi Luca,
>
> The decimal form you're seeing is the default representation of numbers in
> XPath. If you want to drop the decimal, use the function
> string($counterParam).
>
> alex
It works now!
Thanks a lot,
Luca
Re: Problems while coping integer values
Posted by Alex Boisvert <bo...@intalio.com>.
Hi Luca,
The decimal form you're seeing is the default representation of numbers in
XPath. If you want to drop the decimal, use the function
string($counterParam). Here's what the XPath spec section 4.2 says about
the string() function:
if the number is an integer, the number is represented in decimal form as a
Number <http://www.w3.org/TR/xpath#NT-Number> with no decimal point and no
leading zeros, preceded by a minus sign (-) if the number is negative
alex
On 6/21/07, Luca Clementi <l....@cineca.it> wrote:
>
> Hi all,
>
> I am trying to copy an integer value in an attribute with the following
> copy:
>
> <copy>
> <from>$counterParam</from>
> <to>$n0_PAAM_data_in.body/xsd:parameterSet/@id</to>
> </copy>
>
> Where
> <variable messageType="xsd:paamInput" name="n0_PAAM_data_in" />
> <variable name="counterParam" type="xs:integer" />
> and paamInput schema declares the attribute with a:
> <xsd:attribute name="id" type="xsd:integer" use="optional"/>
>
>
> The problem is that final result is:
> <?xml version="1.0" encoding="UTF-8"?>
> <PAAM_in xmlns="http://www.a-ware.org/test/xsd"
> xmlns:xsd="http://www.a-ware.org/test/xsd">
> <templateFile>pluto</templateFile>
> <parameterSet id="1.0"> <----------
> <xsd:parameter>
> <xsd:name>string1</xsd:name>
> <xsd:value>string1</xsd:value>
> </xsd:parameter>
> </parameterSet>
> </PAAM_in>
>
>
> While before the copy it was:
> <parameterSet id="1">
>
> Obviously the final message is invalid because the field that should be
> an integer, is represented with a dot.
>
> Is this a bug or am I doing something wrong?
>
>
> thanks for your help,
> Luca
>
>
>