Hi Mike,
Thanks for the pointer. xs:value-of was one of the erroneous
instructions I was mentioning within my stylesheet, instead of
xsl:value-of. I've now corrected that, and below is my XSLT stylesheet as
of now,
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn0="http://fns0"
exclude-result-prefixes="xs fn0"
version="3.0">
<xsl:output method="text"/>
<xsl:param name="secsSinceEpoch" as="xs:integer"/>
<xsl:template match="/">
<xsl:variable name="epochDateTime"
select="xs:dateTime('1970-01-01T00:00:00Z') +
xs:dayTimeDuration('PT' || $secsSinceEpoch || 'S')"
as="xs:dateTime"/>
<xsl:variable name="diffDTduration" select="current-dateTime() -
$epochDateTime" as="xs:dayTimeDuration"/>
<xsl:value-of select="fn0:minsFromdiffDTduration($diffDTduration)"/>
</xsl:template>
<xsl:function name="fn0:minsFromdiffDTduration" as="xs:string">
<xsl:param name="diffDTduration" as="xs:dayTimeDuration"/>
<xsl:variable name="yrsDuration"
select="years-from-duration($diffDTduration)"/>
<xsl:variable name="mnthsDuration"
select="months-from-duration($diffDTduration)"/>
<xsl:variable name="daysDuration"
select="days-from-duration($diffDTduration)"/>
<xsl:variable name="hrsDuration"
select="hours-from-duration($diffDTduration)"/>
<xsl:variable name="mnsDuration"
select="minutes-from-duration($diffDTduration)"/>
<xsl:variable name="secsDuration"
select="seconds-from-duration($diffDTduration)"/>
<xsl:variable name="totalSecs" select="$yrsDuration + $mnthsDuration
+ $daysDuration + $hrsDuration + $mnsDuration + $secsDuration" />
<xs:sequence select="$totalSecs"/>
</xsl:function>
</xsl:stylesheet>
When I run the above stylesheet, as follows,
java -classpath SaxonHE10-0J\saxon-he-10.0.jar net.sf.saxon.Transform
-s:trf1.xsl -xsl:trf1.xsl secsSinceEpoch=7777777
I get nothing into the output. I'm expecting value of variable $totalSecs
as output of the stylesheet.
Any thoughts, what I'm missing?
On Sat, Mar 28, 2020 at 5:32 PM Michael Kay mike@xxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> It should be xsl:value-of, not xs:value-of.
>
> As written, xs:value-of is a literal result element, which finds its way
> into the result tree, but is then discarded on serialization because that's
> what the text output method does with element nodes.
>
> Michael Kay
> Saxonica
>
--
Regards,
Mukul Gandhi
|