[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re:Re: Current date in a Xsl variable
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|