org.apache.xalan.templates
Class ElemNumber

java.lang.Object
  extended by org.apache.xml.utils.UnImplNode
      extended by org.apache.xalan.templates.ElemTemplateElement
          extended by org.apache.xalan.templates.ElemNumber
All Implemented Interfaces:
java.io.Serializable, javax.xml.transform.SourceLocator, XSLTVisitable, PrefixResolver, ExpressionNode, WhitespaceStrippingElementMatcher, org.w3c.dom.Document, org.w3c.dom.Element, org.w3c.dom.Node, org.w3c.dom.NodeList

public class ElemNumber
extends ElemTemplateElement

Implement xsl:number.

 
 
 

See Also:
number in XSLT Specification, Serialized Form

Nested Class Summary
private  class ElemNumber.MyPrefixResolver
           
(package private)  class ElemNumber.NumberFormatStringTokenizer
          This class returns tokens using non-alphanumberic characters as delimiters.
 
Field Summary
private  CharArrayWrapper m_alphaCountTable
          Chars for converting integers into alpha counts.
private  XPath m_countMatchPattern
          Only nodes are counted that match this pattern.
private  AVT m_format_avt
          The "format" attribute is used to control conversion of a list of numbers into a string.
private  XPath m_fromMatchPattern
          Specifies where to count from.
private  AVT m_groupingSeparator_avt
          The grouping-separator attribute gives the separator used as a grouping (e.g.
private  AVT m_groupingSize_avt
          The optional grouping-size specifies the size (normally 3) of the grouping.
private  AVT m_lang_avt
          When numbering with an alphabetic sequence, the lang attribute specifies which language's alphabet is to be used.
private  AVT m_lettervalue_avt
          The letter-value attribute disambiguates between numbering sequences that use letters.
private  int m_level
          When level="single", it goes up to the first node in the ancestor-or-self axis that matches the count pattern, and constructs a list of length one containing one plus the number of preceding siblings of that ancestor that match the count pattern.
private static DecimalToRoman[] m_romanConvertTable
          Table to help in converting decimals to roman numerals.
private  XPath m_valueExpr
          The value attribute contains an expression.
(package private) static long serialVersionUID
           
 
Fields inherited from class org.apache.xalan.templates.ElemTemplateElement
m_docOrderNumber, m_firstChild, m_hasVariableDecl, m_nextSibling, m_parentNode
 
Fields inherited from class org.apache.xml.utils.UnImplNode
actualEncoding, fDocumentURI
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
ElemNumber()
           
 
Method Summary
 ElemTemplateElement appendChild(ElemTemplateElement newChild)
          Add a child to the child list.
 void callChildVisitors(XSLTVisitor visitor, boolean callAttrs)
          Call the children visitors.
 void compose(StylesheetRoot sroot)
          This function is called after everything else has been recomposed, and allows the template to set remaining values that may be based on some other property that depends on recomposition.
 void execute(TransformerImpl transformer)
          Execute an xsl:number instruction.
(package private)  int findAncestor(XPathContext xctxt, XPath fromMatchPattern, XPath countMatchPattern, int context, ElemNumber namespaceContext)
          Given a 'from' pattern (ala xsl:number), a match pattern and a context, find the first ancestor that matches the pattern (including the context handed in).
private  int findPrecedingOrAncestorOrSelf(XPathContext xctxt, XPath fromMatchPattern, XPath countMatchPattern, int context, ElemNumber namespaceContext)
          Given a 'from' pattern (ala xsl:number), a match pattern and a context, find the first ancestor that matches the pattern (including the context handed in).
(package private)  java.lang.String formatNumberList(TransformerImpl transformer, long[] list, int contextNode)
          Format a vector of numbers into a formatted string.
 XPath getCount()
          Get the "count" attribute.
(package private)  XPath getCountMatchPattern(XPathContext support, int contextNode)
          Get the count match pattern, or a default value.
(package private)  java.lang.String getCountString(TransformerImpl transformer, int sourceNode)
          Given an XML source node, get the count according to the parameters set up by the xsl:number attributes.
 AVT getFormat()
          Get the "format" attribute.
private  void getFormattedNumber(TransformerImpl transformer, int contextNode, char numberType, int numberWidth, long listElement, FastStringBuffer formattedNumber)
          Format the given number and store it in the given buffer
 XPath getFrom()
          Get the "from" attribute.
 AVT getGroupingSeparator()
          Get the "grouping-separator" attribute.
 AVT getGroupingSize()
          Get the "grouping-size" attribute.
 AVT getLang()
          Get the "lang" attribute.
 AVT getLetterValue()
          Get the "letter-value" attribute.
 int getLevel()
          Get the "level" attribute.
(package private)  java.util.Locale getLocale(TransformerImpl transformer, int contextNode)
          Get the locale we should be using.
(package private)  NodeVector getMatchingAncestors(XPathContext xctxt, int node, boolean stopAtFirstFound)
          Get the ancestors, up to the root, that match the pattern.
 java.lang.String getNodeName()
          Return the node name.
private  java.text.DecimalFormat getNumberFormatter(TransformerImpl transformer, int contextNode)
          Get the number formatter to be used the format the numbers
 int getPreviousNode(XPathContext xctxt, int pos)
          Get the previous node to be counted.
 int getTargetNode(XPathContext xctxt, int sourceNode)
          Get the target node that will be counted..
 XPath getValue()
          Get the "value" attribute.
 int getXSLToken()
          Get an int constant identifying the type of element.
(package private)  java.lang.String getZeroString()
          Get a string value for zero, which is not really defined by the 1.0 spec, thought I think it might be cleared up by the erreta.
protected  void int2alphaCount(long val, CharArrayWrapper aTable, FastStringBuffer stringBuf)
          Convert a long integer into alphabetic counting, in other words count using the sequence A B C ...
protected  java.lang.String int2singlealphaCount(long val, CharArrayWrapper table)
          Convert a long integer into alphabetic counting, in other words count using the sequence A B C ...
protected  java.lang.String long2roman(long val, boolean prefixesAreOK)
          Convert a long integer into roman numerals.
 void setCount(XPath v)
          Set the "count" attribute.
 void setFormat(AVT v)
          Set the "format" attribute.
 void setFrom(XPath v)
          Set the "from" attribute.
 void setGroupingSeparator(AVT v)
          Set the "grouping-separator" attribute.
 void setGroupingSize(AVT v)
          Set the "grouping-size" attribute.
 void setLang(AVT v)
          Set the "lang" attribute.
 void setLetterValue(AVT v)
          Set the "letter-value" attribute.
 void setLevel(int v)
          Set the "level" attribute.
 void setValue(XPath v)
          Set the "value" attribute.
protected  java.lang.String tradAlphaCount(long val, XResourceBundle thisBundle)
          Convert a long integer into traditional alphabetic counting, in other words count using the traditional numbering.
 
Methods inherited from class org.apache.xalan.templates.ElemTemplateElement
accept, addOrReplaceDecls, appendChild, callChildVisitors, callVisitors, canAcceptVariables, canStripWhiteSpace, compareTo, containsExcludeResultPrefix, endCompose, error, error, executeNSDecls, executeNSDecls, exprAddChild, exprGetChild, exprGetNumChildren, exprGetParent, exprSetParent, getBaseIdentifier, getChildNodes, getColumnNumber, getDeclaredPrefixes, getDOMBackPointer, getEndColumnNumber, getEndLineNumber, getFirstChild, getFirstChildElem, getLastChild, getLastChildElem, getLength, getLineNumber, getLocalName, getNamespaceForPrefix, getNamespaceForPrefix, getNextSibling, getNextSiblingElem, getNodeType, getOwnerDocument, getOwnerXSLTemplate, getParentElem, getParentNode, getParentNodeElem, getPrefixTable, getPreviousSibling, getPreviousSiblingElem, getPublicId, getStylesheet, getStylesheetComposed, getStylesheetRoot, getSystemId, getTagName, getUid, getXmlSpace, handlesNullPrefixes, hasChildNodes, hasTextLitOnly, hasVariableDecl, insertBefore, isCompiledTemplate, item, needToCheckExclude, recompose, removeChild, replaceChild, replaceChild, resolvePrefixTables, runtimeInit, setDOMBackPointer, setEndLocaterInfo, setLocaterInfo, setParentElem, setPrefixes, setPrefixes, setPrefixTable, setUid, setXmlSpace, shouldStripWhiteSpace, unexecuteNSDecls, unexecuteNSDecls
 
Methods inherited from class org.apache.xml.utils.UnImplNode
adoptNode, appendData, cloneNode, compareDocumentPosition, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, getActualEncoding, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getBaseURI, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getFeature, getImplementation, getInputEncoding, getNamespaceURI, getNodeValue, getOwnerElement, getPrefix, getSchemaTypeInfo, getSpecified, getStrictErrorChecking, getTextContent, getUserData, getWholeText, getXmlEncoding, getXmlStandalone, getXmlVersion, hasAttribute, hasAttributeNS, hasAttributes, importNode, insertData, isDefaultNamespace, isEqualNode, isId, isSameNode, isSupported, isWhitespaceInElementContent, lookupNamespaceURI, lookupPrefix, normalize, normalizeDocument, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, renameNode, replaceData, replaceWholeText, setActualEncoding, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setData, setDocumentURI, setIdAttribute, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setInputEncoding, setNodeValue, setPrefix, setStrictErrorChecking, setTextContent, setUserData, setValue, setXmlEncoding, setXmlStandalone, setXmlVersion, splitText, substringData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

m_alphaCountTable

private CharArrayWrapper m_alphaCountTable
Chars for converting integers into alpha counts.

See Also:
TransformerImpl#int2alphaCount

m_countMatchPattern

private XPath m_countMatchPattern
Only nodes are counted that match this pattern.


m_fromMatchPattern

private XPath m_fromMatchPattern
Specifies where to count from. For level="single" or level="multiple": Only ancestors that are searched are those that are descendants of the nearest ancestor that matches the from pattern. For level="any: Only nodes after the first node before the current node that match the from pattern are considered.


m_level

private int m_level
When level="single", it goes up to the first node in the ancestor-or-self axis that matches the count pattern, and constructs a list of length one containing one plus the number of preceding siblings of that ancestor that match the count pattern. If there is no such ancestor, it constructs an empty list. If the from attribute is specified, then the only ancestors that are searched are those that are descendants of the nearest ancestor that matches the from pattern. Preceding siblings has the same meaning here as with the preceding-sibling axis. When level="multiple", it constructs a list of all ancestors of the current node in document order followed by the element itself; it then selects from the list those nodes that match the count pattern; it then maps each node in the list to one plus the number of preceding siblings of that node that match the count pattern. If the from attribute is specified, then the only ancestors that are searched are those that are descendants of the nearest ancestor that matches the from pattern. Preceding siblings has the same meaning here as with the preceding-sibling axis. When level="any", it constructs a list of length one containing the number of nodes that match the count pattern and belong to the set containing the current node and all nodes at any level of the document that are before the current node in document order, excluding any namespace and attribute nodes (in other words the union of the members of the preceding and ancestor-or-self axes). If the from attribute is specified, then only nodes after the first node before the current node that match the from pattern are considered.


m_valueExpr

private XPath m_valueExpr
The value attribute contains an expression. The expression is evaluated and the resulting object is converted to a number as if by a call to the number function.


m_format_avt

private AVT m_format_avt
The "format" attribute is used to control conversion of a list of numbers into a string.

See Also:
convert in XSLT Specification

m_lang_avt

private AVT m_lang_avt
When numbering with an alphabetic sequence, the lang attribute specifies which language's alphabet is to be used.


m_lettervalue_avt

private AVT m_lettervalue_avt
The letter-value attribute disambiguates between numbering sequences that use letters.


m_groupingSeparator_avt

private AVT m_groupingSeparator_avt
The grouping-separator attribute gives the separator used as a grouping (e.g. thousands) separator in decimal numbering sequences.


m_groupingSize_avt

private AVT m_groupingSize_avt
The optional grouping-size specifies the size (normally 3) of the grouping.


m_romanConvertTable

private static final DecimalToRoman[] m_romanConvertTable
Table to help in converting decimals to roman numerals.

See Also:
DecimalToRoman
Constructor Detail

ElemNumber

public ElemNumber()
Method Detail

setCount

public void setCount(XPath v)
Set the "count" attribute. The count attribute is a pattern that specifies what nodes should be counted at those levels. If count attribute is not specified, then it defaults to the pattern that matches any node with the same node type as the current node and, if the current node has an expanded-name, with the same expanded-name as the current node.

Parameters:
v - Value to set for "count" attribute.

getCount

public XPath getCount()
Get the "count" attribute. The count attribute is a pattern that specifies what nodes should be counted at those levels. If count attribute is not specified, then it defaults to the pattern that matches any node with the same node type as the current node and, if the current node has an expanded-name, with the same expanded-name as the current node.

Returns:
Value of "count" attribute.

setFrom

public void setFrom(XPath v)
Set the "from" attribute. Specifies where to count from. For level="single" or level="multiple": Only ancestors that are searched are those that are descendants of the nearest ancestor that matches the from pattern. For level="any: Only nodes after the first node before the current node that match the from pattern are considered.

Parameters:
v - Value to set for "from" attribute.

getFrom

public XPath getFrom()
Get the "from" attribute. For level="single" or level="multiple": Only ancestors that are searched are those that are descendants of the nearest ancestor that matches the from pattern. For level="any: Only nodes after the first node before the current node that match the from pattern are considered.

Returns:
Value of "from" attribute.

setLevel

public void setLevel(int v)
Set the "level" attribute. The level attribute specifies what levels of the source tree should be considered; it has the values single, multiple or any. The default is single.

Parameters:
v - Value to set for "level" attribute.

getLevel

public int getLevel()
Get the "level" attribute. The level attribute specifies what levels of the source tree should be considered; it has the values single, multiple or any. The default is single.

Returns:
Value of "level" attribute.

setValue

public void setValue(XPath v)
Set the "value" attribute. The value attribute contains an expression. The expression is evaluated and the resulting object is converted to a number as if by a call to the number function.

Parameters:
v - Value to set for "value" attribute.

getValue

public XPath getValue()
Get the "value" attribute. The value attribute contains an expression. The expression is evaluated and the resulting object is converted to a number as if by a call to the number function.

Returns:
Value of "value" attribute.

setFormat

public void setFormat(AVT v)
Set the "format" attribute. The "format" attribute is used to control conversion of a list of numbers into a string.

Parameters:
v - Value to set for "format" attribute.
See Also:
convert in XSLT Specification

getFormat

public AVT getFormat()
Get the "format" attribute. The "format" attribute is used to control conversion of a list of numbers into a string.

Returns:
Value of "format" attribute.
See Also:
convert in XSLT Specification

setLang

public void setLang(AVT v)
Set the "lang" attribute. When numbering with an alphabetic sequence, the lang attribute specifies which language's alphabet is to be used; it has the same range of values as xml:lang [XML]; if no lang value is specified, the language should be determined from the system environment. Implementers should document for which languages they support numbering.

Parameters:
v - Value to set for "lang" attribute.
See Also:
convert in XSLT Specification

getLang

public AVT getLang()
Get the "lang" attribute. When numbering with an alphabetic sequence, the lang attribute specifies which language's alphabet is to be used; it has the same range of values as xml:lang [XML]; if no lang value is specified, the language should be determined from the system environment. Implementers should document for which languages they support numbering.

Returns:
Value ofr "lang" attribute.
See Also:
convert in XSLT Specification

setLetterValue

public void setLetterValue(AVT v)
Set the "letter-value" attribute. The letter-value attribute disambiguates between numbering sequences that use letters.

Parameters:
v - Value to set for "letter-value" attribute.
See Also:
convert in XSLT Specification

getLetterValue

public AVT getLetterValue()
Get the "letter-value" attribute. The letter-value attribute disambiguates between numbering sequences that use letters.

Returns:
Value to set for "letter-value" attribute.
See Also:
convert in XSLT Specification

setGroupingSeparator

public void setGroupingSeparator(AVT v)
Set the "grouping-separator" attribute. The grouping-separator attribute gives the separator used as a grouping (e.g. thousands) separator in decimal numbering sequences.

Parameters:
v - Value to set for "grouping-separator" attribute.
See Also:
convert in XSLT Specification

getGroupingSeparator

public AVT getGroupingSeparator()
Get the "grouping-separator" attribute. The grouping-separator attribute gives the separator used as a grouping (e.g. thousands) separator in decimal numbering sequences.

Returns:
Value of "grouping-separator" attribute.
See Also:
convert in XSLT Specification

setGroupingSize

public void setGroupingSize(AVT v)
Set the "grouping-size" attribute. The optional grouping-size specifies the size (normally 3) of the grouping.

Parameters:
v - Value to set for "grouping-size" attribute.
See Also:
convert in XSLT Specification

getGroupingSize

public AVT getGroupingSize()
Get the "grouping-size" attribute. The optional grouping-size specifies the size (normally 3) of the grouping.

Returns:
Value of "grouping-size" attribute.
See Also:
convert in XSLT Specification

compose

public void compose(StylesheetRoot sroot)
             throws javax.xml.transform.TransformerException
This function is called after everything else has been recomposed, and allows the template to set remaining values that may be based on some other property that depends on recomposition.

Overrides:
compose in class ElemTemplateElement
Throws:
javax.xml.transform.TransformerException

getXSLToken

public int getXSLToken()
Get an int constant identifying the type of element.

Overrides:
getXSLToken in class ElemTemplateElement
Returns:
The token ID for this element
See Also:
Constants

getNodeName

public java.lang.String getNodeName()
Return the node name.

Specified by:
getNodeName in interface org.w3c.dom.Node
Overrides:
getNodeName in class ElemTemplateElement
Returns:
The element's name

execute

public void execute(TransformerImpl transformer)
             throws javax.xml.transform.TransformerException
Execute an xsl:number instruction. The xsl:number element is used to insert a formatted number into the result tree.

Overrides:
execute in class ElemTemplateElement
Parameters:
transformer - non-null reference to the the current transform-time state.
Throws:
javax.xml.transform.TransformerException

appendChild

public ElemTemplateElement appendChild(ElemTemplateElement newChild)
Add a child to the child list.

Overrides:
appendChild in class ElemTemplateElement
Parameters:
newChild - Child to add to child list
Returns:
Child just added to child list
Throws:
DOMException

findAncestor

int findAncestor(XPathContext xctxt,
                 XPath fromMatchPattern,
                 XPath countMatchPattern,
                 int context,
                 ElemNumber namespaceContext)
           throws javax.xml.transform.TransformerException
Given a 'from' pattern (ala xsl:number), a match pattern and a context, find the first ancestor that matches the pattern (including the context handed in).

Parameters:
xctxt - The XPath runtime state for this.
fromMatchPattern - The ancestor must match this pattern.
countMatchPattern - The ancestor must also match this pattern.
context - The node that "." expresses.
namespaceContext - The context in which namespaces in the queries are supposed to be expanded.
Returns:
the first ancestor that matches the given pattern
Throws:
javax.xml.transform.TransformerException

findPrecedingOrAncestorOrSelf

private int findPrecedingOrAncestorOrSelf(XPathContext xctxt,
                                          XPath fromMatchPattern,
                                          XPath countMatchPattern,
                                          int context,
                                          ElemNumber namespaceContext)
                                   throws javax.xml.transform.TransformerException
Given a 'from' pattern (ala xsl:number), a match pattern and a context, find the first ancestor that matches the pattern (including the context handed in).

Parameters:
xctxt - The XPath runtime state for this.
fromMatchPattern - The ancestor must match this pattern.
countMatchPattern - The ancestor must also match this pattern.
context - The node that "." expresses.
namespaceContext - The context in which namespaces in the queries are supposed to be expanded.
Returns:
the first preceding, ancestor or self node that matches the given pattern
Throws:
javax.xml.transform.TransformerException

getCountMatchPattern

XPath getCountMatchPattern(XPathContext support,
                           int contextNode)
                     throws javax.xml.transform.TransformerException
Get the count match pattern, or a default value.

Parameters:
support - The XPath runtime state for this.
contextNode - The node that "." expresses.
Returns:
the count match pattern, or a default value.
Throws:
javax.xml.transform.TransformerException

getCountString

java.lang.String getCountString(TransformerImpl transformer,
                                int sourceNode)
                          throws javax.xml.transform.TransformerException
Given an XML source node, get the count according to the parameters set up by the xsl:number attributes.

Parameters:
transformer - non-null reference to the the current transform-time state.
sourceNode - The source node being counted.
Returns:
The count of nodes
Throws:
javax.xml.transform.TransformerException

getPreviousNode

public int getPreviousNode(XPathContext xctxt,
                           int pos)
                    throws javax.xml.transform.TransformerException
Get the previous node to be counted.

Parameters:
xctxt - The XPath runtime state for this.
pos - The current node
Returns:
the previous node to be counted.
Throws:
javax.xml.transform.TransformerException

getTargetNode

public int getTargetNode(XPathContext xctxt,
                         int sourceNode)
                  throws javax.xml.transform.TransformerException
Get the target node that will be counted..

Parameters:
xctxt - The XPath runtime state for this.
sourceNode - non-null reference to the current source node.
Returns:
the target node that will be counted
Throws:
javax.xml.transform.TransformerException

getMatchingAncestors

NodeVector getMatchingAncestors(XPathContext xctxt,
                                int node,
                                boolean stopAtFirstFound)
                          throws javax.xml.transform.TransformerException
Get the ancestors, up to the root, that match the pattern.

Parameters:
xctxt - The XPath runtime state for this.
node - Count this node and it's ancestors.
stopAtFirstFound - Flag indicating to stop after the first node is found (difference between level = single or multiple)
Returns:
The number of ancestors that match the pattern.
Throws:
javax.xml.transform.TransformerException

getLocale

java.util.Locale getLocale(TransformerImpl transformer,
                           int contextNode)
                     throws javax.xml.transform.TransformerException
Get the locale we should be using.

Parameters:
transformer - non-null reference to the the current transform-time state.
contextNode - The node that "." expresses.
Returns:
The locale to use. May be specified by "lang" attribute, but if not, use default locale on the system.
Throws:
javax.xml.transform.TransformerException

getNumberFormatter

private java.text.DecimalFormat getNumberFormatter(TransformerImpl transformer,
                                                   int contextNode)
                                            throws javax.xml.transform.TransformerException
Get the number formatter to be used the format the numbers

Parameters:
transformer - non-null reference to the the current transform-time state.
contextNode - The node that "." expresses. ($objectName$) @return The number formatter to be used
Throws:
javax.xml.transform.TransformerException

formatNumberList

java.lang.String formatNumberList(TransformerImpl transformer,
                                  long[] list,
                                  int contextNode)
                            throws javax.xml.transform.TransformerException
Format a vector of numbers into a formatted string.

Parameters:
transformer - non-null reference to the the current transform-time state.
list - Array of one or more long integer numbers.
contextNode - The node that "." expresses.
Returns:
String that represents list according to %conversion-atts; attributes. TODO: Optimize formatNumberList so that it caches the last count and reuses that info for the next count.
Throws:
javax.xml.transform.TransformerException

getFormattedNumber

private void getFormattedNumber(TransformerImpl transformer,
                                int contextNode,
                                char numberType,
                                int numberWidth,
                                long listElement,
                                FastStringBuffer formattedNumber)
                         throws javax.xml.transform.TransformerException
Format the given number and store it in the given buffer

Parameters:
transformer - non-null reference to the the current transform-time state.
contextNode - The node that "." expresses.
numberType - Type to format to
numberWidth - Maximum length of formatted number
listElement - Number to format
formattedNumber - Buffer to store formatted number
Throws:
javax.xml.transform.TransformerException

getZeroString

java.lang.String getZeroString()
Get a string value for zero, which is not really defined by the 1.0 spec, thought I think it might be cleared up by the erreta.


int2singlealphaCount

protected java.lang.String int2singlealphaCount(long val,
                                                CharArrayWrapper table)
Convert a long integer into alphabetic counting, in other words count using the sequence A B C ... Z.

Parameters:
val - Value to convert -- must be greater than zero.
table - a table containing one character for each digit in the radix
Returns:
String representing alpha count of number.
See Also:
Note that the radix of the conversion is inferred from the size of the table.

int2alphaCount

protected void int2alphaCount(long val,
                              CharArrayWrapper aTable,
                              FastStringBuffer stringBuf)
Convert a long integer into alphabetic counting, in other words count using the sequence A B C ... Z AA AB AC.... etc.

Parameters:
val - Value to convert -- must be greater than zero.
table - a table containing one character for each digit in the radix
aTable - Array of alpha characters representing numbers
stringBuf - Buffer where to save the string representing alpha count of number.
See Also:
Note that the radix of the conversion is inferred from the size of the table.

tradAlphaCount

protected java.lang.String tradAlphaCount(long val,
                                          XResourceBundle thisBundle)
Convert a long integer into traditional alphabetic counting, in other words count using the traditional numbering.

Parameters:
val - Value to convert -- must be greater than zero.
thisBundle - Resource bundle to use
Returns:
String representing alpha count of number.
See Also:
Note that the radix of the conversion is inferred from the size of the table.

long2roman

protected java.lang.String long2roman(long val,
                                      boolean prefixesAreOK)
Convert a long integer into roman numerals.

Parameters:
val - Value to convert.
prefixesAreOK - true_ to enable prefix notation (e.g. 4 = "IV"), false_ to disable prefix notation (e.g. 4 = "IIII").
Returns:
Roman numeral string.
See Also:
DecimalToRoman, m_romanConvertTable

callChildVisitors

public void callChildVisitors(XSLTVisitor visitor,
                              boolean callAttrs)
Call the children visitors.

Overrides:
callChildVisitors in class ElemTemplateElement
Parameters:
visitor - The visitor whose appropriate method will be called.