com.interface21.web.servlet.view.xslt
Class FormatHelper

java.lang.Object
  |
  +--com.interface21.web.servlet.view.xslt.FormatHelper

public class FormatHelper
extends java.lang.Object

Xalan extension functions to provide date and currency formatting beyond the capabilities of XSLT 1.0 or 1.1.
Note that all extension functions are static.
These extension functions must be declared to use this class.
Based on an example by Taylor Cowan.

Author:
Rod Johnson

Inner Class Summary
static class FormatHelper.XsltFormattingException
           
 
Constructor Summary
FormatHelper()
           
 
Method Summary
static java.lang.String currency(double amount, java.util.Locale locale)
          Format a currency amount in a given locale
static java.lang.String currency(double amount, java.lang.String language, java.lang.String country)
          Format a currency amount in a given locale
static org.w3c.dom.Node dateTimeElement(long time)
           
static org.w3c.dom.Node dateTimeElement(long time, java.util.Locale locale)
          Create an XML element to represent this system time in the current locale.
static org.w3c.dom.Node dateTimeElement(long date, java.lang.String language, java.lang.String country)
          Creates a formatted-date node with the given ISO language and country strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormatHelper

public FormatHelper()
Method Detail

dateTimeElement

public static org.w3c.dom.Node dateTimeElement(long date,
                                               java.lang.String language,
                                               java.lang.String country)
Creates a formatted-date node with the given ISO language and country strings.

dateTimeElement

public static org.w3c.dom.Node dateTimeElement(long time)

dateTimeElement

public static org.w3c.dom.Node dateTimeElement(long time,
                                               java.util.Locale locale)
Create an XML element to represent this system time in the current locale. Enables XSLT stylesheets to display content, without needing to do the work of internationalization.

currency

public static java.lang.String currency(double amount,
                                        java.util.Locale locale)
Format a currency amount in a given locale

currency

public static java.lang.String currency(double amount,
                                        java.lang.String language,
                                        java.lang.String country)
Format a currency amount in a given locale


Rod Johnson and Spring contributors 2001-2003.