org.opencms.util
Class CmsXsltUtil

java.lang.Object
  extended by org.opencms.util.CmsXsltUtil

public final class CmsXsltUtil
extends java.lang.Object

Provides utility functions for XSLT transformations.

Since:
6.2.1
Version:
$Revision: 1.9 $
Author:
Carsten Weinholz

Field Summary
static java.lang.String TAG_END_DELIMITER
          The delimiter to end a tag.
static java.lang.String TAG_START_DELIMITER
          The delimiter to start a tag.
static char TEXT_DELIMITER
          The delimiter to separate the text.
 
Method Summary
static java.lang.String getPreferredDelimiter(java.lang.String csvData)
          Returns the delimiter that most often occures in the CSV content and is therefore best applicable for the CSV data .
static java.lang.String transformCsvContent(CmsObject cms, java.lang.String xsltFile, java.lang.String csvContent, java.lang.String delimiter)
          Changes content from CSV to xml/html.
static java.lang.String transformXmlContent(CmsObject cms, java.lang.String xsltFile, java.lang.String xmlContent)
          Applies a XSLT Transformation to the content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_END_DELIMITER

public static final java.lang.String TAG_END_DELIMITER
The delimiter to end a tag.

See Also:
Constant Field Values

TAG_START_DELIMITER

public static final java.lang.String TAG_START_DELIMITER
The delimiter to start a tag.

See Also:
Constant Field Values

TEXT_DELIMITER

public static final char TEXT_DELIMITER
The delimiter to separate the text.

See Also:
Constant Field Values
Method Detail

getPreferredDelimiter

public static java.lang.String getPreferredDelimiter(java.lang.String csvData)
Returns the delimiter that most often occures in the CSV content and is therefore best applicable for the CSV data .

Parameters:
csvData - the comma separated values
Returns:
the delimiter that is best applicable for the CSV data

transformCsvContent

public static java.lang.String transformCsvContent(CmsObject cms,
                                                   java.lang.String xsltFile,
                                                   java.lang.String csvContent,
                                                   java.lang.String delimiter)
                                            throws CmsException,
                                                   CmsXmlException
Changes content from CSV to xml/html.

The method does not use DOM4J, because iso-8859-1 code ist not transformed correctly.

Parameters:
cms - the cms object
xsltFile - the XSLT transformation file
csvContent - the csv content to transform
delimiter - delimiter used to separate csv fields
Returns:
the transformed xml
Throws:
CmsXmlException - if something goes wrong
CmsException - if something goes wrong

transformXmlContent

public static java.lang.String transformXmlContent(CmsObject cms,
                                                   java.lang.String xsltFile,
                                                   java.lang.String xmlContent)
                                            throws CmsException,
                                                   CmsXmlException
Applies a XSLT Transformation to the content.

The method does not use DOM4J, because iso-8859-1 code ist not transformed correctly.

Parameters:
cms - the cms object
xsltFile - the XSLT transformation file
xmlContent - the XML content to transform
Returns:
the transformed xml
Throws:
CmsXmlException - if something goes wrong
CmsException - if something goes wrong