xsl-list
[Top] [All Lists]

Re: Q - Value of param doesn't change !

2005-05-31 06:18:29

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
________________________________________________________________________

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



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