On Fri, 6 Oct 2000, Paul Madsen wrote:

> For XML like
> 
> <event>
>     <from>
>         <time>7</time>
>     </from>
>     <to>
>         <time>18</time>
>     </to>
> </event>
> 
> I'd like to calculate the events temporal duration. Logically, something
> 
> like
> 
>  <xsl:template match="event">
>     <p><b>Duration: </b><xsl:substract(to/time,from/time) /></p>
>   </xsl:template>
> 
> but I can't find examples of the substract function (or whatever its
> called if indeed there is something comparable)

Just use <xsl:value-of select="to/time - from/time"/>

Of course ths assumes your time values are in some sensible numeric format
that can be subtracted, rather than dates.

-- 
<Matt/>

** Director and CTO **
**  AxKit.com Ltd   **  ** XML Application Serving **
** http://axkit.org **  ** XSLT, XPathScript, XSP  **
**     Personal Web Site: http://sergeant.org/     **

Reply via email to