public final class XSLTHelper extends Object
When calling methods that don't have parameters from a style sheet, don't forget the call braces or you'll end up with a no-op.
This class has static methods for consistent behaviour between JDK versions. With instance methods the XSLTC implementation in Java 5.0 needs the instance to be passed as the first argument, whereas the Xalan implementation in Java 1.4 does not.
Modifier and Type | Method and Description |
---|---|
static String |
base64ToClojure(String base64String)
Convert a base64 string of binary data to a vector of bytes scriptlet.
|
static String |
base64ToPython(String base64String)
Convert a base64 string of binary data to an array of bytes scriptlet.
|
static String |
changeIndent(int indentChange)
Change the indent level.
|
static String |
escape(String value)
Escape quotes and back slashes for Python.
|
static String |
formatTime(String iso8601)
Convert an ISO 8601 date/time string to a more friendly, locale specific
string.
|
static String |
indent()
Return an appropriately indent string.
|
static String |
newLine()
Return a new line string.
|
static String |
newLineAndIndent()
|
static String |
quoteEOLEscapedStringForClojure(String value)
Wrap string in appropriate quotes for Clojure, passing through existing EOL
escapes {"\n", "\r"}, and quoting real new lines.
|
static String |
quoteEOLEscapedStringForPython(String value)
Wrap string in appropriate quotes for Python, passing through existing EOL
escapes {"\n", "\r"}, and quoting real new lines.
|
static String |
quoteForClojure(String value)
Wrap string in appropriate quotes for Clojure.
|
static String |
quoteForPython(String value)
Wrap string in appropriate quotes for Python.
|
static String |
resetIndent()
Reset the indent level.
|
static void |
setIndentString(String indentString)
Allow the indentation string to be overridden.
|
static String |
summariseAsLine(String value,
int maximumCharacters)
Transform new line characters and other control characters to a printable
representation.
|
public static String formatTime(String iso8601) throws ParseException
iso8601
- An extended format ISO 8601 date/time stringParseException
- If the date could not be parsed.public static String quoteForPython(String value)
value
- The string.public static String quoteEOLEscapedStringForPython(String value)
value
- The string.SimpleStringEscaper
public static String quoteForClojure(String value)
value
- The string.public static String quoteEOLEscapedStringForClojure(String value)
value
- The string.SimpleStringEscaper
public static String summariseAsLine(String value, int maximumCharacters)
maximumCharacters
. If the string is truncated,
add ellipses.value
- The input string.maximumCharacters
- Truncate at this number of characters if result would otherwise be
longer.public static String escape(String value)
value
- The string.public static String indent()
changeIndent(int)
,
resetIndent()
,
setIndentString(String)
public static String newLine()
public static String newLineAndIndent()
public static String changeIndent(int indentChange)
indentChange
- Offset to indent level, positive or negative.public static String resetIndent()
public static String base64ToPython(String base64String)
base64String
- The binary data.public static String base64ToClojure(String base64String)
base64String
- The binary data.public static void setIndentString(String indentString)
indentString
- The indentation string.indent()
,
changeIndent(int)
,
resetIndent()
Copyright © 2000-2014. All Rights Reserved.