XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Matt KlemSubject: Conversion of negative numbers
Author: Matt Klem
Date: 11 Jul 2011 02:17 PM
I'm relatively new to Stylus Studio but have been doing a lot of flat file to XML conversions. I have a situation where negative numbers in the flat file are not coming across in my XML as negatives.

Here's a snippet from the flat text file I am converting:
----
>>Calculated Amount: ($100.00)
>>Fixed Amount: -$100.00
----

So in this example, I capture both values as XML. However, when they are converted, only the second (Fixed) one comes out as a negative. For the first (Calculated) one comes out as a positive number even though it is actually a negative.

Here's the resulting XML I get:

<Calculated>
<Value>100</Value>
</Calculated>
<Fixed>
<Value>-100</Value>
</Fixed>

I have specified "Number" as my datatype but this has not helped. Anyone have any suggestions?

Posttop
Ivan PedruzziSubject: Conversion of negative numbers
Author: Ivan Pedruzzi
Date: 20 Jul 2011 03:46 PM
Matt,

I suggest to set the type back to string and post process the resulting XML using either XQuery or XSLT to remove the () and insert the minus sign

Hope this helps
Ivan

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.