com.novell.xsl.process
Class NumberTemplate

java.lang.Object
  extended bycom.novell.xsl.process.NumberTemplate
All Implemented Interfaces:
Template
Direct Known Subclasses:
AnyNumberTemplate, MultiNumberTemplate, SingleNumberTemplate

public abstract class NumberTemplate
extends Object
implements Template

An abstract class for templates that add a formatted number to the result tree. Such templates correspond to the xsl:number element.


Nested Class Summary
protected static class NumberTemplate.ParsedFormat
          A class representing a parsed number format string.
 
Field Summary
protected  Pattern countPattern
          A match pattern specifying what nodes this number template counts; null means count elements having the same type name as the current node.
protected  Expression digitGroupSepExpr
          A string expression specifying the separator this number template uses between groups of digits; null means there are no digit group separators.
protected  Expression digitsPerGroupExpr
          A string expression specifying the number of digits per group; null means there are no digit group separators.
protected  Expression formatExpr
          A string expression specifying how this number template formats numbers.
protected  Pattern fromPattern
          A match pattern specifying where this number template starts counting from; null means counting starts from the beginning of the document.
protected  Expression langExpr
          A string expression specifying the language this number template uses for alphabetic sequences; null means determine the language from the system environment.
protected  Expression letterValueExpr
          A string expression that disambiguates between numbering schemes that use letters.
protected  NumberTemplate.ParsedFormat preparsedFormat
          This number template's parsed number format if the format, lang, and letter value expressions can be evaluated at compile time; null means at least one of those three expressions needs to be evaluated at runtime.
protected  Expression valueExpr
          A number expression used to determine the number to format.
 
Constructor Summary
NumberTemplate(Pattern countPattern, Pattern fromPattern, Expression formatExpr, Expression langExpr, Expression letterValueExpr, Expression digitGroupSepExpr, Expression digitsPerGroupExpr, Expression valueExpr, Node nsContext)
          Constructs a number template.
 
Method Summary
 void dump(PrintWriter out, int indent)
          Dumps this object to the specified output stream.
 Node getNamespaceContext()
          Return the node that is the namespace context for this template
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.novell.xsl.process.Template
instantiate
 

Field Detail

countPattern

protected Pattern countPattern
A match pattern specifying what nodes this number template counts; null means count elements having the same type name as the current node.


fromPattern

protected Pattern fromPattern
A match pattern specifying where this number template starts counting from; null means counting starts from the beginning of the document.


formatExpr

protected Expression formatExpr
A string expression specifying how this number template formats numbers.


langExpr

protected Expression langExpr
A string expression specifying the language this number template uses for alphabetic sequences; null means determine the language from the system environment.


letterValueExpr

protected Expression letterValueExpr
A string expression that disambiguates between numbering schemes that use letters. What does null mean?


digitGroupSepExpr

protected Expression digitGroupSepExpr
A string expression specifying the separator this number template uses between groups of digits; null means there are no digit group separators.


digitsPerGroupExpr

protected Expression digitsPerGroupExpr
A string expression specifying the number of digits per group; null means there are no digit group separators.


valueExpr

protected Expression valueExpr
A number expression used to determine the number to format. null means no expression specified, so use the position of the current node in the source tree


preparsedFormat

protected NumberTemplate.ParsedFormat preparsedFormat
This number template's parsed number format if the format, lang, and letter value expressions can be evaluated at compile time; null means at least one of those three expressions needs to be evaluated at runtime. This is an optimization that avoids unnecessary parsing of the number format at runtime.

Constructor Detail

NumberTemplate

public NumberTemplate(Pattern countPattern,
                      Pattern fromPattern,
                      Expression formatExpr,
                      Expression langExpr,
                      Expression letterValueExpr,
                      Expression digitGroupSepExpr,
                      Expression digitsPerGroupExpr,
                      Expression valueExpr,
                      Node nsContext)
               throws XSLException
Constructs a number template.

Parameters:
countPattern - a match pattern specifying the nodes to be counted; null means count elements having the same type name as the current node
fromPattern - a match pattern specifying where counting starts from; null means counting starts from the beginning of the document
formatExpr - a string expression specifying how to format the numbers
langExpr - a string expression specifying the language to use for alphabetic sequences; null means determine the language from the system environment
letterValueExpr - a string expression that disambiguates between numbering schemes that use letters; must evaluate to alphabetic or traditional; what does null mean?
digitGroupSepExpr - a string expression specifying the separator between groups of digits; null means there are no digit group separators
digitsPerGroupExpr - a string expression specifying the number of digits per group; null means there are no digit group separators
valueExpr - a number expression which is evaluated to get the number that is to be formated. If null then the position of the current node in the source document is used.
nsContext - The node in the style sheet from which this template comes
Throws:
XSLException - if a fatal error occurs during construction
Method Detail

getNamespaceContext

public Node getNamespaceContext()
Return the node that is the namespace context for this template

Specified by:
getNamespaceContext in interface Template
Returns:
The namespace context node.

dump

public void dump(PrintWriter out,
                 int indent)
Dumps this object to the specified output stream.

Specified by:
dump in interface Template
Parameters:
out - the output stream to write to
indent - number of tabs to indent