com.novell.xsl.util
Class Util

java.lang.Object
  extended bycom.novell.xsl.util.Util

public final class Util
extends Object

This class consists exclusively of static utility methods.


Field Summary
static String SPACE_DEFAULT
          One of the valid values for the xml:space attribute.
static String SPACE_PRESERVE
          One of the valid values for the xml:space attribute.
 
Method Summary
static double getWildcardNamePriority(WildcardName name)
          Convenience function to return the default priority for a WildcardName.
static String getXSLStringValue(List nodeList)
          Returns the XSL-defined string value for the specified node list.
static String getXSLStringValue(Node node)
          Returns the XSL-defined string value for the specified node.
static void indent(PrintWriter writer, int tabs)
          Output specified number of tabs.
static Locale parseLang(String lang)
          Parses the value of the specified xml:lang value and returns a corresponding java.util.Locale object.
static boolean stripWhitespaceNode(Node node)
          Evaluate a stylesheet node to see if it should be stripped according to the XSL whitespace stripping rules
static String unicodeEscape(char ch)
          Returns the specified character as a Java-style Unicode escape of the form "\\uXXXX".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPACE_DEFAULT

public static final String SPACE_DEFAULT
One of the valid values for the xml:space attribute.

See Also:
Constant Field Values

SPACE_PRESERVE

public static final String SPACE_PRESERVE
One of the valid values for the xml:space attribute.

See Also:
Constant Field Values
Method Detail

getXSLStringValue

public static String getXSLStringValue(Node node)
Returns the XSL-defined string value for the specified node.

Parameters:
node - the node whose string value is to be returned
Returns:
the node's string value

getXSLStringValue

public static String getXSLStringValue(List nodeList)
Returns the XSL-defined string value for the specified node list.

Parameters:
nodeList - the node list whose string value is to be returned
Returns:
the node list's string value

parseLang

public static Locale parseLang(String lang)
                        throws IllegalArgumentException
Parses the value of the specified xml:lang value and returns a corresponding java.util.Locale object.

Currently this method supports the two-letter language codes defined by ISO-639 and the two-letter country codes defined by ISO-3166, since that is what the javadocs for java.util.Locale say it supports. This method does not yet support the IANA-defined and user-defined codes allowed in XML 1.0.

Parameters:
lang - the xml:lang value to be parsed; null causes the current default locale to be returned
Returns:
the corresponding locale
Throws:
IllegalArgumentException - if the passed language string is invalid

unicodeEscape

public static String unicodeEscape(char ch)
Returns the specified character as a Java-style Unicode escape of the form "\\uXXXX".

Parameters:
ch - the character to escape
Returns:
the Java-style Unicode escape

stripWhitespaceNode

public static boolean stripWhitespaceNode(Node node)
Evaluate a stylesheet node to see if it should be stripped according to the XSL whitespace stripping rules

Parameters:
node - the DOM node to evaluate
Returns:
true if node should be stripped

getWildcardNamePriority

public static double getWildcardNamePriority(WildcardName name)
Convenience function to return the default priority for a WildcardName. This exists so it can be used by com.novell.xsl.process.ElementMatch and com.novell.xsl.pattern.NodeTestPattern

Parameters:
name - The WildcardName to examine.
Returns:
The default priority of the passed WildcardName

indent

public static void indent(PrintWriter writer,
                          int tabs)
Output specified number of tabs.

Parameters:
writer - PrintWriter to output to.
tabs - Number of tabs to output.