如何在 XSLT 1.0 中获取当前日期和时间 [英] How to get current date and time in XSLT 1.0

查看:52
本文介绍了如何在 XSLT 1.0 中获取当前日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 xslt 1.0,我正在尝试将当前日期和时间打印到我的节点.下面是示例 xslt

I am using xslt 1.0, I am trying to print current date and time to my node. Below is the sample xslt

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:em="http://www.emirates.com/tridion/schemas" xmlns:tcmse="http://www.tridion.com/ContentManager/5.1/TcmScriptAssistant" exclude-result-prefixes="em xlink tcmse tcm">
  <xsl:output method="xml" version="1.0" encoding="UTF-16" indent="yes"/>

  <!-- Common XSLT Templates-->
  <xsl:include href="tcm:228-190524-2048"/>
  <!-- root match-->
  <xsl:template match="root">
    <sitedata>
      <resources>        
        <PublishedDate>
          <xsl:value-of select="$publishedDate"/>
        </PublishedDate>
      </resources>     
    </sitedata>
  </xsl:template>

在上面的 XSLT 中,在 $publishedDate 的位置我想要系统当前的日期和时间

In above XSLT, in the place of $publishedDate I want system current date and time

请提出建议!!

推荐答案

XSLT 1.0 没有提供任何标准方法来获取当前日期/时间.您可以调用扩展函数来执行此操作(取决于您的处理器),也可以将其作为参数值传递给样式表.

XSLT 1.0 does not provide any standard way to get the current date/time. You can call an extension function to do it (depends on your processor), or you can pass it to the stylesheet as the value of a parameter.

这篇关于如何在 XSLT 1.0 中获取当前日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆