Link to home
Create AccountLog in
Avatar of piratepatrol
piratepatrolFlag for United States of America

asked on

Number is Getting Turned into Scientific Notation Format

Hey guys,

I have the following short snippet:

<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:date="http://exslt.org/dates-and-times"
      xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"
      xmlns:o="urn:schemas-microsoft-com:office:office"
       xmlns:x="urn:schemas-microsoft-com:office:excel"
      xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
      xmlns:ms="urn:schemas-microsoft-com:office:spreadsheet"
      xmlns:boo="http://www.sungard.com/consulting/ercot"
      xmlns:util="http://www.sungard.com/consulting/util"
      exclude-result-prefixes="ms o x ss"
>

    <xsl:output method="xml" version="1.0" encoding="ISO-8859-1" omit-xml-declaration="no" standalone="no" indent="yes" doctype-system="schedules.dtd" />

    <xsl:template match="/">
        <boo>
            Hour: <xsl:value-of select="concat('Hello ', boo:hour-ending-for-interval(0700))"/>
        </boo>
    </xsl:template>

    <xsl:function name="boo:hour-ending-for-interval">
        <xsl:param name="interval"/>
        <xsl:variable name="operating_hour">
            <xsl:value-of select="substring($interval, 1, 2)"/>
        </xsl:variable>
        <xsl:choose>
            <xsl:when test="substring($interval, 3, 2) = '00'">
                <xsl:value-of select="number($operating_hour)"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$operating_hour + 1"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:function>

</xsl:stylesheet>

This yields an output of

Hour: Hello 7.1E1

I can't have that scientific notation format in my output.  I notice that when I remove the concat function, it displays the output in non-scientific notation format.  

Any thoughts why concat is screwing up my output?

Thanks so much,


Jazon
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of piratepatrol

ASKER

It works!  Thanks so much, Gertone!