|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Math: Removing X number of zeroes from number Y.
Hi Ahsan,
I was trying to solve this problem, using XSLT 2.0
functions ..
The stylesheet I have written so far is (it is not
complete) -
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:num="http://whatever"
version="2.0">
<xsl:output method="text" indent="yes" />
<xsl:template match="/">
<xsl:value-of select="num:div_pow(79000, 2)"/>
</xsl:template>
<xsl:function name="num:div_pow" as="xs:double">
<xsl:param name="x" as="xs:double"/>
<xsl:param name="y" as="xs:integer"/>
<xsl:if test="$y &t; 0">
<xsl:
</xsl:if>
</xsl:function>
</xsl:stylesheet>
I am handicaped by the fact that XSLT 2.0 does not
have a construct like xsl:call-function (similar to
xsl:call-template) ..
Is my doubt genuine ..?
Regards,
Mukul
--- Ahsan Ali <doubleletter@xxxxxxxxx> wrote:
> Hi,
>
> I have a fare element that is returned as, for
> example, 79000. The
> decimal point value is specified in another element
> as for example 2.
> Therefore the number should be: 790.00
>
> There's a way to do this mathematically:
>
> Where x=DecimalPoint, and y=fare, the forumla would
> be y/(10^x)
>
> But as far as I know there's no exponential function
> in XSLT 1.0. I'm
> using, or rather, _have_ to use MSXML, I can't go
> for FXSLT, etc.
>
> It's worth mentioning that fare is of type 'double'
> and DecimalPoint
> is of type 'short'
>
> Anyone have any ideas on how to do this in plain XSL
> ?
>
> Any help is appreciated,
>
> Best Regards,
>
> Ahsan
>
> --
> http://doubleletter.blogspot.com
>
>
__________________________________
Discover Yahoo!
Find restaurants, movies, travel and more fun for the weekend. Check it out!
http://discover.yahoo.com/weekend.html
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








