如何将xslt函数返回值设置为变量?

cod*_*joe 2 xslt

我需要进一步处理我生成的xsl值,如下所示:

<xsl:value-of select="adjust-dateTime-to-timezone(xs:dateTime('2006-02-15T17:00:00-03:00'), xs:dayTimeDuration('-PT7H'))" />
Run Code Online (Sandbox Code Playgroud)

我想得到结果,只保留几个子串(3个子串操作).

我怎样才能做到这一点?现在,上面的代码将结果转储为"2006-02-15T13:00:00-07:00".

Rod*_*kov 5

您可以将变量设置为函数返回的值,然后将该变量用于任何其他变换.

<xsl:variable name="result" select="adjust-dateTime-to-timezone(xs:dateTime('2006-02-15T17:00:00-03:00'), xs:dayTimeDuration('-PT7H'))" />
Run Code Online (Sandbox Code Playgroud)

要么

<xsl:variable name="result">
    <xsl:value-of select="adjust-dateTime-to-timezone(xs:dateTime('2006-02-15T17:00:00-03:00'), xs:dayTimeDuration('-PT7H'))" />
</xsl:variable>
Run Code Online (Sandbox Code Playgroud)

然后

<xsl:value-of select="$result"/>
Run Code Online (Sandbox Code Playgroud)