Allright. I converted the xquery code to the below xsl code:
<xsl:template match="JrnyTm">
<xsl:variable name="onemin" select="
xdt:dayTimeDuration('PT1M')"/>
<xsl:variable name="time" select="xs:integer(.) * $onemin"/>
<xsl:variable name="hours"
select="xs:hours-from-duration($time)"/>
<xsl:variable name="mins"
select="xs:minutes-from-duration($time)"/>
<xsl:value-of select="concat($hours, ' hrs', $mins, ' mins')"/>
</xsl:template>
Now the problem is that the xdt namespace is not recognised !
The namespace definition is:
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdt="http://www.w3.org/2005/04/xpath-datatype"
I get an error:"Namespace 'http://www.w3.org/2005/04/xpath-datatype'
does not contain any functions."
I'm using the MSXML XSL processor...
Regards, Ahsan
On 5/30/05, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
Is there way to do this in pure XSLT instead of Xquery ??
Of course. Just replace
let $x := EXPR
and
declare variable $x := EXPR
by
<xsl:variable name="x" select="EXPR"/>
and replace
"return X" by
<xsl:value-of select="X"/>
Michael Kay
http://www.saxonica.com/
You've got a choice between using numeric arithmetic or
duration arithmetic.
It's probably cleanest to use duration arithmetic though
it's a bit verbose.
declare variable $one-minute := xdt:dayTimeDuration('PT1M')
then
let $time := xs:integer(JrnyTm) * $one-minute,
$hours := hours-from-duration($time),
$minutes := minutes-from-duration($time)
return
concat($hours, ' hrs ', $minutes, ' minutes ')
Regards, Ahsan
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--