473,395 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XSL format-number spews garbage in first row, subsequest rows formatted correctly

============= XML content ==================

<?xml version="1.0"?>
<cdb>
<spill>
<ctx_volume>142300000</ctx_volume>
<date>19670318</date>
<shipname>TORREY CANYON</shipname>
</spill>
<spill>
<ctx_volume>20400000</ctx_volume>
<date>19670905</date>
<shipname>R C STONER</shipname>
</spill>
<spill>
<ctx_volume>25000000</ctx_volume>
<date>19671024</date>
<shipname>GIORGIO FASSIO</shipname>
</spill>
</cdb>


============= XSL Stylesheet ==================


<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:for-each select="cdb/spill">
<xsl:sort select="ctx_volume" order="descending" data-type="number"/>
<xsl:value-of select="shipname"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="format-number(ctx_volume, '###,###,###')"/><br />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


============= OUTPUT ==================

TORREY CANYON-142ÿ00ÿ00 <------------ PROBLEM!!!!!!!!! ------------>
GIORGIO FASSIO-25,000,000
R C STONER-20,400,000


============= NOTES ==================

if you change the sort order, try:

<xsl:sort select="shipname" order="ascending" data-type="text"/>

you will notice that what ever line is FIRST, the format-number function outputs garbage,
but ONLY FOR THE FIRST ITERATION


The XSLT transformation is handled by PHP. Here is a link to my PHPINFO dump for the server in question:

http://c4tx.modwest.com/test.php5


==========================================
please reply to: codeproblems@ulccs.com
Nov 9 '06 #1
0 1771

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Dario Di Bella | last post by:
Hi all, we have the following urgent issue affecting our development team. Initially we had one particular workstation that failed executing queries on a DB2 database, raising an invalid date...
1
by: Julius Fenata | last post by:
Dear all, I need help to change my item-template value format... Here is my case, I have a datagrid, with 'SubjectPrice' field, and when the grid displayed, my 'SubjectPrice' field displayed...
10
by: Ron | last post by:
Hello, The following code works in a Form class module but not a standard module: Dim d1 As DateTime Format(d1, "MMMM") In a standard module I get a squigly line saying that an argument has...
8
by: Thunder | last post by:
Hi All, I'm using VB.Net 2005. I have for years used Format to format strings and dates, etc... Now when I try to use Format I get the following error? "'Format' is a type and can not be used...
3
by: karthikla | last post by:
Hi Experts, Could you please help me on how to get access 2002 file format exactly while doing conversion from Access 97 file format by DBEngine.CompactDatabase() function? Code: Private...
7
by: Rick | last post by:
With String.Format, if I have an incorrect number of args specified for a format string, compile fails. How can I implement similar design-time functionality for my own string functions?
3
by: Carl Trachte | last post by:
Hello. Python 3.0.a1 has been released. I'm trying to get the hang of the new string formatting in the form: '5.66' There are more options in PEP 3101 (fill, alignment, etc.), but I'm having...
10
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a...
8
by: Armando Rocha | last post by:
Hi, Hi have a string with 16 chars "25DD68EDEB8D5E11" and i want show it in form like this "25DD-68ED-EB8D-5E11", i try String.Format("{0:####-####-####-####}", mystr), but not work, i think...
7
by: Andrus | last post by:
How to create format string for decimal data type which shows blank for zero and default format otherwize ? I tried format string "f;f;#" but this shows f for nonzero numbers. Andrus. ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.