org.weborganic.bastille.xml
Class XSLTUtils

java.lang.Object
  extended by org.weborganic.bastille.xml.XSLTUtils

public final class XSLTUtils
extends Object

A utility class to help with XSLT operations.

Since:
0.6.0

Method Summary
 void clearCache()
          Clears the internal XSLT cache.
static Templates getTemplates(URL url)
          Return the XSLT templates from the given style.
static Templates getTemplates(URL url, boolean cache)
          Return the XSLT templates from the given style.
static Templates getTemplatesFromResource(String resource)
          Return the XSLT templates from the given style.
static Templates getTemplatesFromResource(String resource, boolean cache)
          Return the XSLT templates from the given style.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTemplates

public static Templates getTemplates(URL url)
                              throws BerliozException
Return the XSLT templates from the given style.

Parameters:
url - A URL to a template.
Returns:
the corresponding XSLT templates object or null if the URL was null.
Throws:
BerliozException - If XSLT templates could not be loaded from the specified URL.

getTemplates

public static Templates getTemplates(URL url,
                                     boolean cache)
                              throws BerliozException
Return the XSLT templates from the given style.

Parameters:
url - A URL to a template.
cache - true to load and store from the cache or not; false to force load from the URL and clear the cache entry for this URL.
Returns:
the corresponding XSLT templates object or null if the URL was null.
Throws:
BerliozException - If XSLT templates could not be loaded from the specified URL.

getTemplatesFromResource

public static Templates getTemplatesFromResource(String resource)
                                          throws BerliozException
Return the XSLT templates from the given style.

This method will firt try to load the resource using the class loader used for this class.

Use this class to load XSLT from the system.

Parameters:
resource - The path to a resource.
Returns:
the corresponding XSLT templates object; or null if the resource could not be found.
Throws:
BerliozException - If the loading fails.

getTemplatesFromResource

public static Templates getTemplatesFromResource(String resource,
                                                 boolean cache)
                                          throws BerliozException
Return the XSLT templates from the given style.

This method will firt try to load the resource using the class loader used for this class.

Use this class to load XSLT from the system.

Parameters:
resource - The path to a resource.
cache - true to load and store from the cache or not; false to load from the URL and clear the cache entry for this resource.
Returns:
the corresponding XSLT templates object; or null if the resource could not be found.
Throws:
BerliozException - If the loading fails.

clearCache

public void clearCache()
Clears the internal XSLT cache.