Jump to content

Server Date/time


dies_felices

Recommended Posts

Hi everyone. Is it possible to get date and time information from the server and to process that information in XSLT? I would like to render a different page for a different day or after a particular time or until a time. Since I can't control the client terminal I can't rely upon it to have the right date or time.

<root>    <Schedule day="Monday" date="2012.01.09">        <Some_Data />    </Schedule>    <Schedule day="Tuesday" date="2012.01.10">        <Some_Data />    </Schedule></root>

Please help. --Many thanks. Stephen.

Link to comment
Share on other sites

Hi. I've been following your Javascript suggestion this has led me to http://www.w3.org/TR/xslt11/#ecmascript-binding.

<?xml version = '1.0' encoding = 'ISO-8859-1'?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rand="~/" version="1.1"><xsl:output method="html" omit-xml-declaration="yes"/><xsl:script implements-prefix="rand"language="ecmascript">function num() {var thisResult = parseInt(Math.random()*100);return thisResult;}</xsl:script><xsl:template match="/"><xsl:value-of select="rand:num()"/></xsl:template></xsl:stylesheet>

This is some xslt being run against a xml file, the results are not encouraging. Opera reports:-

This document had an invalid XSLT stylesheet. Error message from the XSLT engine:Error: XPath expression compilation failed: rand:num()Details: parse error (characters 1-8): undeclared prefix in qualified name: ''

While Firefox reports:-

Error during XSLT transformation: An unknown XPath extension function was called.

Any ideas? Thanks.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...