[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re:Re: Current date in a Xsl variable

Subject: Re:Re: Current date in a Xsl variable
From: Rajendra S Rawat <rajsrawat@xxxxxxxxx>
Date: Wed, 10 Sep 2003 05:49:42 -0700 (PDT)
xsl current date
try 

xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java">

in <xsl:stylesheet ...

 then use

<xsl:value-of
select="java:format(java:java.text.SimpleDateFormat.new('dd/MM/yyyy'),
java:java.util.Date.new())"/>

to directly print currrent date


Cheers,

Raj
--- logchem.news@xxxxxxxxx wrote:
> Hi M.David, 
> 
> When I use your code, I get the error:
> "Error in XPath expression, Function not in
> namespace"
> Do you know whats wrong?
> 
> Thanks,
> Peter
> 
> 
> Xsl file:
>
______________________________________________________
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:my="urn:my-scripts">
> <xsl:output method="html"/>
> 
> 	<xsl:template match="root">
> 		<html><head>
> 
> 		<script type="JavaScript" 
> implements-prefix="my"><![CDATA[
> 		
> 		        function returnDate(){
> 		
> 		           var d, s;
> 		           d = new Date();
> 		           s += (d.getMonth() + 1) + "/";
> 		           s += d.getDate() + "/";
> 		           s += d.getYear();
> 		           return(s);
> 		        }
> 
> 		]]></script>
> 
> 		</head><body>				
> 		<xsl:variable name="date"
> select="my:returnDate()"/>
> 	
> 		<p>Today: <xsl:value-of select="$date"/></p>
> 		</body></html> 
> 	</xsl:template>
> 
> </xsl:stylesheet>
>
_____________________________________________________
> 
> Xml file:
>
_____________________________________________________
> <?xml version="1.0" encoding="UTF-8"?>
> <root>
> 	<naam>Peter</naam>
> 	<datum>2000-08-28T15:39:49</datum>
> 	<dag>28</dag>
> 	<maand>3</maand>
> 	<jaar>2000</jaar>
> </root>
>
______________________________________________________
> 
> 
> 
> -- 
>
_____________________________________________________________________
> Snel en voordelig ADSL nu voor iedereen bereikbaar.
> Zon Breedband Budget vanaf EUR 14,95 per maand.
> Nu tijdelijk geen aansluitkosten. Bestel snel op
> zonnet.nl/breedband
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.