Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2008, 01:57 AM
Authorized User
 
Join Date: Jul 2008
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default Current date format

XSLT: Version 1.0
Processor: Xalan-C_1_8_0-windows_2000-msvc_60 /xerces-c_2_5_0-windows_nt-msvc_60
Platform: Windows XP

[u]XSL output:</u>
XSLT Warning: The function 'format-number()' is not implemented..Source tree node: #document. (Line -1, column -1.)
XSLT Warning: The function 'format-number()' is not implemented..Source tree node: #document. (Line -1, column -1.)

CurrentDate without format: 2008-08-06T06:54:3606:00

CurrentDate with format:Jan 1,1998 (but the input i given as 2008-08-02)

[u]File.xsl</u>

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date" version="1.0">

<xsl:output method="text"/>

<xsl:include href="date.format-date.template.xsl"/>

<xsl:template match="/">

<xsl:variable name="currentDate" select="date:date-time()"/>
CurrentDate without format: <xsl:value-of select="$currentDate"/>

<xsl:variable name="result">
    <xsl:call-template name="date:format-date">
    [t<xsl:with-param name="date-time" select="2008-08-02"/>
        <xsl:with-param name="pattern" select="'MMM dd,yyyy'"/>
    </xsl:call-template>
</xsl:variable>

CurrentDate with format:<xsl:value-of select="$result"/>

</xsl:template>

</xsl:stylesheet>

[u]Query:</u>
Why the currentDate with format is not correct with current date and why such a warning message.
 
Old August 6th, 2008, 02:46 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Well obviously the XSLT processor you are using doesn't support format-number() function, so whatever is in the date.format-date.template.xsl file isn't working, therefore your output is not correct.

Seems fairly self explanatary to me.

/- Sam Judson : Wrox Technical Editor -/
 
Old August 6th, 2008, 03:08 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

A quick google for "Xalan-C format-number" reveals that to enable the format-number function to work with Xalan-C you need to configure the product to use the ICU library. (If you need help with that, ask on the Xalan forums, not here!)

I expect the error occurred because the included stylesheet module date.format-date.template.xsl contains a call to format-number().

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
date format differs, need to force format somehow patricolsson ASP.NET 2.0 Basics 1 December 3rd, 2009 12:53 AM
Convert British format date to American format? fyr PHP How-To 0 December 19th, 2007 03:17 PM
Current Date s15199d Reporting Services 2 April 3rd, 2006 12:38 AM
date format differs, need to force format somehow patricolsson HTML Code Clinic 2 January 12th, 2006 05:55 AM
Current Date rgudino Java Databases 1 May 5th, 2005 03:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.