Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.dataxslt
Class StylesheetCache

    java.lang.Object
      com.knowgate.dataxslt.StylesheetCache

    public class StylesheetCache

extends java.lang.Object

XSL File Cache This class keeps a master copy in memory of each XSL Stylesheet file.
When a Transformer object is requested a copy of the master Stylesheet is done. This is faster than re-loading de XSL file from disk.
StylesheetCache is a WeakHashMap so cached stylesheets can be automatically garbage collected is memory runs low.

Method Summary
`static javax.xml.transform.Transformer` | `newTransformer(java.lang.String sFilePath)` Get Transformer object for XSL file.
`static void` | `setParameters(javax.xml.transform.Transformer oXSL, java.util.Properties oProps)` Set parameters for a StyleSheet taken from a properties collection.
`static java.lang.String` | `transform(java.io.InputStream oStyleSheetStream, java.io.InputStream oXMLInputStream, java.lang.String sEncoding, java.util.Properties oProps)` Perform XSLT transformation
`static java.lang.String` | `transform(java.io.InputStream oStyleSheetStream, java.lang.String sXMLInput, java.util.Properties oProps)` Perform XSLT transformation
`static void` | `transform(java.lang.String sStyleSheetPath, java.io.InputStream oXMLInputStream, java.io.OutputStream oOutputStream, java.util.Properties oProps)` Perform XSLT transformation
`static java.lang.String` | `transform(java.lang.String sStyleSheetPath, java.lang.String sXMLInput, java.util.Properties oProps)` Perform XSLT transformation

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### newTransformer

    public static javax.xml.transform.Transformer newTransformer(java.lang.String sFilePath)
                                                          throws java.io.FileNotFoundException,
                                                                 java.io.IOException,
                                                                 javax.xml.transform.TransformerException,
                                                                 javax.xml.transform.TransformerConfigurationException

  Get Transformer object for XSL file. StylesheetCache automatically checks file last modification date and compares it with loading date for cached objects. If file is more recent than its cached object then the disk copy is reloaded.

  Parameters:
    `sFilePath` - File Path
  Throws:
    `java.io.IOException`
    `javax.xml.transform.TransformerException`
    `javax.xml.transform.TransformerConfigurationException`
    `java.io.FileNotFoundException`

### setParameters

    public static void setParameters(javax.xml.transform.Transformer oXSL,
                                     java.util.Properties oProps)
                              throws java.lang.NullPointerException

  Set parameters for a StyleSheet taken from a properties collection. This method is primarily designed for setting environment parameters.

  Parameters:
    `oXSL` - Transformer object.
    `oProps` - Properties to be set as parameters. The substring "param_" will be added as a preffix to each property name passed as parameter. So if you pass a property named "workarea" it must be retrieved from XSL as <xsl:param name="param_workarea"/>
  Throws:
    `java.lang.NullPointerException` - if oXSL is null or oProps is null

### transform

    public static void transform(java.lang.String sStyleSheetPath,
                                 java.io.InputStream oXMLInputStream,
                                 java.io.OutputStream oOutputStream,
                                 java.util.Properties oProps)
                          throws java.io.IOException,
                                 java.io.FileNotFoundException,
                                 java.lang.NullPointerException,
                                 javax.xml.transform.TransformerException,
                                 javax.xml.transform.TransformerConfigurationException

  Perform XSLT transformation

  Parameters:
    `sStyleSheetPath` - File Path to XSL style sheet file
    `oXMLInputStream` - Input Stream for XML source data
    `oOutputStream` - Stream where output is to be written
    `oProps` - Parameters for Transformer. The substring "param_" will be added as a preffix to each property name passed as parameter. So if you pass a property named "workarea" it must be retrieved from XSL as <xsl:param name="param_workarea"/>
  Throws:
    `java.lang.NullPointerException` - if oProps is null
    `java.io.FileNotFoundException` - if sStyleSheetPath does not exist
    `java.io.IOException`
    `javax.xml.transform.TransformerException`
    `javax.xml.transform.TransformerConfigurationException`

### transform

    public static java.lang.String transform(java.lang.String sStyleSheetPath,
                                             java.lang.String sXMLInput,
                                             java.util.Properties oProps)
                                      throws java.io.IOException,
                                             java.io.FileNotFoundException,
                                             java.io.UnsupportedEncodingException,
                                             java.lang.NullPointerException,
                                             javax.xml.transform.TransformerException,
                                             javax.xml.transform.TransformerConfigurationException

  Perform XSLT transformation

  Parameters:
    `sStyleSheetPath` - File Path to XSL style sheet file
    `sXMLInput` - Input String with XML source data
    `oProps` - Parameters for Transformer. The substring "param_" will be added as a preffix to each property name passed as parameter. So if you pass a property named "workarea" it must be retrieved from XSL as <xsl:param name="param_workarea"/>
  Returns:
    String Transformed document
  Throws:
    `java.lang.NullPointerException` - if sXMLInput or oProps are null
    `java.io.FileNotFoundException` - if sStyleSheetPath does not exist
    `java.io.IOException`
    `java.io.UnsupportedEncodingException`
    `javax.xml.transform.TransformerException`
    `javax.xml.transform.TransformerConfigurationException`
  Since:
    3.0

### transform

    public static java.lang.String transform(java.io.InputStream oStyleSheetStream,
                                             java.io.InputStream oXMLInputStream,
                                             java.lang.String sEncoding,
                                             java.util.Properties oProps)
                                      throws java.io.IOException,
                                             java.io.FileNotFoundException,
                                             java.io.UnsupportedEncodingException,
                                             java.lang.NullPointerException,
                                             javax.xml.transform.TransformerException,
                                             javax.xml.transform.TransformerConfigurationException

  Perform XSLT transformation

  Parameters:
    `oStyleSheetStream` - Stream to XSL style sheet
    `oXMLInput` - Input Stream with XML source data
    `oEncoding` - Input Stream data encoding
    `oProps` - Parameters for Transformer. The substring "param_" will be added as a preffix to each property name passed as parameter. So if you pass a property named "workarea" it must be retrieved from XSL as <xsl:param name="param_workarea"/>
  Returns:
    String Transformed document
  Throws:
    `java.lang.NullPointerException` - if sXMLInput or oProps are null
    `java.io.FileNotFoundException` - if sStyleSheetPath does not exist
    `java.io.IOException`
    `java.io.UnsupportedEncodingException`
    `javax.xml.transform.TransformerException`
    `javax.xml.transform.TransformerConfigurationException`
  Since:
    6.0

### transform

    public static java.lang.String transform(java.io.InputStream oStyleSheetStream,
                                             java.lang.String sXMLInput,
                                             java.util.Properties oProps)
                                      throws java.io.IOException,
                                             java.io.FileNotFoundException,
                                             java.io.UnsupportedEncodingException,
                                             java.lang.NullPointerException,
                                             javax.xml.transform.TransformerException,
                                             javax.xml.transform.TransformerConfigurationException

  Perform XSLT transformation

  Parameters:
    `oStyleSheetStream` - Stream to XSL style sheet
    `sXMLInput` - Input String with XML source data
    `oProps` - Parameters for Transformer. The substring "param_" will be added as a preffix to each property name passed as parameter. So if you pass a property named "workarea" it must be retrieved from XSL as <xsl:param name="param_workarea"/>
  Returns:
    String Transformed document
  Throws:
    `java.lang.NullPointerException` - if sXMLInput or oProps are null
    `java.io.FileNotFoundException` - if sStyleSheetPath does not exist
    `java.io.IOException`
    `java.io.UnsupportedEncodingException`
    `javax.xml.transform.TransformerException`
    `javax.xml.transform.TransformerConfigurationException`
  Since:
    5.0

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD