You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by KAPIL MADAN <kr...@yahoo.com> on 2000/05/31 16:04:32 UTC

XSL-Help

How can we get current date in the xsl
something like date() 
is there anything like that ??
reply-to: kmadan@hotmail.com

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

Re: XSL-Help

Posted by Willie Wheeler <ww...@andrew.cmu.edu>.
Hi Kapil,

    I don't know if this is what you are looking for, but just in case, here
is an XSP that gives the date and an XSL stylesheet for it. If you are
talking about doing it with XSL alone, I don't know whether there is a way
to do that.

    Willie



myXsp.xml:
===========
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="stylesheet.xsl" type="text/xsl"?>

<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">
  <page title="Time of Day">

    <xsp:logic>
      Date now = new Date();
    </xsp:logic>

    <p>Current time: <xsp:expr>now</xsp:expr></p>
  </page>
</xsp:page>




stylesheet.xsl
==========
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="page">
    <xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
    <html>
    <head><title><xsl:value-of select="@title"/></title></head>
    <body>
      <h3 style="color: navy; text-align: left"><xsl:value-of
select="@title"/></h3>
      <p><xsl:apply-templates select="p"/></p>
    </body>
    </html>
  </xsl:template>

</xsl:stylesheet>


----- Original Message -----
From: KAPIL MADAN <kr...@yahoo.com>
To: <co...@xml.apache.org>
Sent: Wednesday, May 31, 2000 10:04 AM
Subject: XSL-Help


> How can we get current date in the xsl
> something like date()
> is there anything like that ??
> reply-to: kmadan@hotmail.com
>
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>