1

I am attempting to place the current date/time into an XSLT document.

The XSLT:

<xsl:template name="global" match="/">
    <body>
        <h1>Feed</h1>
        <div class="date"><xsl:value-of select="current-dateTime()"/></div>
        <xsl:apply-templates select="products[@productCode='REMSA']"/>
    </body>
</xsl:template>

When the current-dateTime() function is in place, it and anything below it will not render on the page. Anything above it will show up just fine. I get no errors, just blank space. This is day 4 of me looking at XSLT so I am very new this language. Any help, tips, or recommendations will go a long way.

Thank You!

Andrew Hill
  • 2,165
  • 1
  • 26
  • 39
  • 3
    When you say *will not render on the page*, do you mean that this XSLT is intended to run in a Web browser? If so, that's your problem: the XSLT engines built into current Web browsers support XSLT 1.0, not 2.0. If not, tell us some more about the environment. – C. M. Sperberg-McQueen May 27 '14 at 13:39

1 Answers1

0

Maybe you missed to declare the XSL function namespace to have access to the current-dateTime() function:

Add to your xsl root element the fn declaration:...:

xmlns:fn="http://www.w3.org/2005/xpath-functions"

...and change your statement to:

<xsl:value-of select="fn:current-dateTime()"/>

see also:

http://www.w3schools.com/xpath/xpath_functions.asp#datetime

Can an XSLT insert the current date?

Community
  • 1
  • 1
actc
  • 672
  • 1
  • 9
  • 23