this is a german Web-Mirror of MHONARC.ORG powered by Domainunion AG

[Top] [All Lists]

Re: [xsl] problem with scientific notation and leading whitespaces

2013-07-18 08:44:18
Have you tried:

  <xsl:value-of select="normalize-space( Apples * Bananas )"/>

... in which the expression is translated into a string and then the leading and trailing white-space characters are removed.

I hope this helps.

. . . . . . . Ken

At 2013-07-18 15:34 +0200, Silvio Abruzzo wrote:
Dear All,

I have a problem with the following example

$ cat testLarge.xml
<?xml version="1.0" encoding="utf-8"?>

$ cat testSmall.xml
<?xml version="1.0" encoding="utf-8"?>

$ cat collect.xslt
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="";>
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="Refrigerator">
      <xsl:value-of select="Apples * Bananas" />

$ xsltproc collect.xslt testLarge.xml
<?xml version="1.0"?>

$ xsltproc collect.xslt testSmall.xml
<?xml version="1.0"?>

The problem that you may notice is that when I use testLarge.xml the
resulting value contains a leading whitespace, i.e. it is something
like " 5e+25". Instead, with small numbers I obtain "50" without
leading whitespace.

Is this a bug? Should or could I configure something in order to not
have this problem? I would like to NOT have the leading whitespace.
Note that it is not acceptable to have a function which removes the
whitespace, the reason is that in my real xml file I have already
hundreds of fields and I cannot modify all of them by hand. It would
be acceptable a global solution.

Here my data
$ xsltproc --version
Using libxml 20900, libxslt 10127 and libexslt 816
xsltproc was compiled against libxml 20900, libxslt 10127 and libexslt 816
libxslt 10127 was compiled against libxml 20900
libexslt 816 was compiled against libxml 20900

Thank you very much for your answer.
Kind regards,

Abruzzo Silvio

XSL-List info and archive:
To unsubscribe, go to:
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>

Public XSLT, XSL-FO, and UBL classes in the Netherlands     Oct 2013 |
Public XSLT, XSL-FO, UBL and code list classes in Australia Oct 2013 |
Contact us for world-wide XML consulting and instructor-led training |
Free 5-hour lecture: |
Crane Softwrights Ltd.   |
G. Ken Holman                   mailto:gkholman(_at_)CraneSoftwrights(_dot_)com 
Google+ profile: |
Legal business disclaimers: |

XSL-List info and archive:
To unsubscribe, go to:
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>

<Prev in Thread] Current Thread [Next in Thread>