|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xalan.lib.ExsltBase org.apache.xalan.lib.ExsltStrings
This class contains EXSLT strings extension functions. It is accessed by specifying a namespace URI as follows:
xmlns:math="http://exslt.org/strings"The documentation for each function has been copied from the relevant EXSLT Implementer page.
Field Summary | |
private static org.w3c.dom.Document |
lDoc
|
Constructor Summary | |
ExsltStrings()
|
Method Summary | |
static String |
align(String targetStr,
String paddingStr)
See above |
static String |
align(String targetStr,
String paddingStr,
String type)
The str:align function aligns a string within another string. |
static String |
concat(org.w3c.dom.NodeList nl)
The str:concat function takes a node set and returns the concatenation of the string values of the nodes in that node set. |
static String |
padding(double length)
See above |
static String |
padding(double length,
String pattern)
The str:padding function creates a padding string of a certain length. |
static org.w3c.dom.NodeList |
split(String str)
See above |
static org.w3c.dom.NodeList |
split(String str,
String pattern)
The str:split function splits up a string and returns a node set of token elements, each containing one token from the string. |
static org.w3c.dom.NodeList |
tokenize(String toTokenize)
See above |
static org.w3c.dom.NodeList |
tokenize(String toTokenize,
String delims)
The str:tokenize function splits up a string and returns a node set of token elements, each containing one token from the string. |
Methods inherited from class org.apache.xalan.lib.ExsltBase |
toNumber, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static org.w3c.dom.Document lDoc
Constructor Detail |
public ExsltStrings()
Method Detail |
public static String align(String targetStr, String paddingStr, String type)
The first argument gives the target string to be aligned. The second argument gives the padding string within which it is to be aligned.
If the target string is shorter than the padding string then a range of characters in the padding string are repaced with those in the target string. Which characters are replaced depends on the value of the third argument, which gives the type of alignment. It can be one of 'left', 'right' or 'center'. If no third argument is given or if it is not one of these values, then it defaults to left alignment.
With left alignment, the range of characters replaced by the target string begins with the first character in the padding string. With right alignment, the range of characters replaced by the target string ends with the last character in the padding string. With center alignment, the range of characters replaced by the target string is in the middle of the padding string, such that either the number of unreplaced characters on either side of the range is the same or there is one less on the left than there is on the right.
If the target string is longer than the padding string, then it is truncated to be the same length as the padding string and returned.
targetStr
- The target stringpaddingStr
- The padding stringtype
- The type of alignment
public static String align(String targetStr, String paddingStr)
public static String concat(org.w3c.dom.NodeList nl)
nl
- A node set
public static String padding(double length, String pattern)
length
- The length of the padding string to be createdpattern
- The string to be used as pattern
public static String padding(double length)
public static org.w3c.dom.NodeList split(String str, String pattern)
The first argument is the string to be split. The second argument is a pattern string. The string given by the first argument is split at any occurrence of this pattern. For example:
str:split('a, simple, list', ', ') gives the node set consisting of:If the second argument is omitted, the default is the string ' ' (i.e. a space).a simple list
str
- The string to be splitpattern
- The pattern
public static org.w3c.dom.NodeList split(String str)
public static org.w3c.dom.NodeList tokenize(String toTokenize, String delims)
The first argument is the string to be tokenized. The second argument is a string consisting of a number of characters. Each character in this string is taken as a delimiting character. The string given by the first argument is split at any occurrence of any of these characters. For example:
str:tokenize('2001-06-03T11:40:23', '-T:') gives the node set consisting of:If the second argument is omitted, the default is the string ' ' (i.e. whitespace characters).2001 06 03 11 40 23
If the second argument is an empty string, the function returns a set of token elements, each of which holds a single character.
Note: This one is different from the tokenize extension function in the Xalan namespace. The one in Xalan returns a set of Text nodes, while this one wraps the Text nodes inside the token Element nodes.
toTokenize
- The string to be tokenizeddelims
- The delimiter string
public static org.w3c.dom.NodeList tokenize(String toTokenize)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |