Re: [xsl] Q - Value of param doesn't change ! [solved]

Subject: Re: [xsl] Q - Value of param doesn't change ! [solved]
From: Ahsan Ali <doubleletter@xxxxxxxxx>
Date: Tue, 31 May 2005 17:34:01 +0400
Ah... you're right.. I should've simply used the floor function
instead of the format-number... I guess that's what was causing the
problem.

You see, the relevance to my earlier question is that for the
remaining elements (which I excluded since it was a huge xml file), it
was giving me 7 hrs -20 mins for _every_ element !

Anyways.. everything's fine now !

Thank you !

Best Regards, Ahsan

On 5/31/05, David Carlisle <davidc@xxxxxxxxx> wrote:
>
> So, what's your problem? If I run your posted files I get
>
> $ saxon j.xml j.xsl
> <table xmlns:xs="http://www.w3.org/2001/XMLSchema"; width="98%" border="0"
cellP
> dding="0" cellSpacing="1" bgcolor="#CCCCCC" class="searchResult">
>    <tbody>
>       <tr>
>          <td>7 hrs -20 mins</td>
>       </tr>
>       <tr>
>          <td>7 hrs -20 mins</td>
>       </tr>
>    </tbody>
> </table>
>
>
> But both of your input times were the same, if I change one of them from
> <JrnyTm>400</JrnyTm>
> to
> <JrnyTm>500</JrnyTm>
> I get
> <table xmlns:xs="http://www.w3.org/2001/XMLSchema"; width="98%" border="0"
cellPa
> dding="0" cellSpacing="1" bgcolor="#CCCCCC" class="searchResult">
>    <tbody>
>       <tr>
>          <td>7 hrs -20 mins</td>
>       </tr>
>       <tr>
>          <td>8 hrs 20 mins</td>
>       </tr>
>    </tbody>
> </table>
>
> showing the time is recalculated..
>
> Your actual calculation is probably not what you want (you probably
> always want the minuutes to be positive) but your example doesn't show
> the problem that you stated in your original post.
>
> You don't want to use format-number to get a string and then number()
> to convert it back to a number, you probably just want something like
>
> <xsl:with-param name="hrs" select="floor(JrnyTm div 60)"/>
> <xsl:with-param name="mins" select="JrnyTm - floor(JrnyTm div 60) * 60"/>
>
> which gives
>
>       <tr>
>          <td>6 hrs 40 mins</td>
>       </tr>
>       <tr>
>          <td>8 hrs 20 mins</td>
>       </tr>
>
>
> David
>
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________

Current Thread