|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.utils.UnImplNode org.apache.xalan.templates.ElemTemplateElement org.apache.xalan.templates.ElemNumber
Implement xsl:number.
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 static char[] |
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. thousands) separator in decimal numbering sequences. |
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. |
Fields inherited from class org.apache.xalan.templates.ElemTemplateElement |
m_docOrderNumber, m_firstChild, m_hasVariableDecl, m_nextSibling, m_parentNode, m_prefixTable |
Fields inherited from interface org.w3c.dom.Node |
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, 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) 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) 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) 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. |
String |
getNodeName()
Return the node name. |
private 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) 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,
char[] aTable,
FastStringBuffer stringBuf)
Convert a long integer into alphabetic counting, in other words count using the sequence A B C ... |
protected String |
int2singlealphaCount(long val,
char[] table)
Convert a long integer into alphabetic counting, in other words count using the sequence A B C ... |
protected 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 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private XPath m_countMatchPattern
private XPath m_fromMatchPattern
private int m_level
private XPath m_valueExpr
private AVT m_format_avt
private AVT m_lang_avt
private AVT m_lettervalue_avt
private AVT m_groupingSeparator_avt
private AVT m_groupingSize_avt
private static final DecimalToRoman[] m_romanConvertTable
DecimalToRoman
private static char[] m_alphaCountTable
TransformerImpl#int2alphaCount
Constructor Detail |
public ElemNumber()
Method Detail |
public void setCount(XPath v)
v
- Value to set for "count" attribute.public XPath getCount()
public void setFrom(XPath v)
v
- Value to set for "from" attribute.public XPath getFrom()
public void setLevel(int v)
v
- Value to set for "level" attribute.public int getLevel()
public void setValue(XPath v)
v
- Value to set for "value" attribute.public XPath getValue()
public void setFormat(AVT v)
v
- Value to set for "format" attribute.public AVT getFormat()
public void setLang(AVT v)
v
- Value to set for "lang" attribute.public AVT getLang()
public void setLetterValue(AVT v)
v
- Value to set for "letter-value" attribute.public AVT getLetterValue()
public void setGroupingSeparator(AVT v)
v
- Value to set for "grouping-separator" attribute.public AVT getGroupingSeparator()
public void setGroupingSize(AVT v)
v
- Value to set for "grouping-size" attribute.public AVT getGroupingSize()
public void compose(StylesheetRoot sroot) throws javax.xml.transform.TransformerException
compose
in class ElemTemplateElement
javax.xml.transform.TransformerException
public int getXSLToken()
getXSLToken
in class ElemTemplateElement
Constants
public String getNodeName()
getNodeName
in interface org.w3c.dom.Node
getNodeName
in class ElemTemplateElement
public void execute(TransformerImpl transformer) throws javax.xml.transform.TransformerException
execute
in class ElemTemplateElement
transformer
- non-null reference to the the current transform-time state.
javax.xml.transform.TransformerException
public ElemTemplateElement appendChild(ElemTemplateElement newChild)
appendChild
in class ElemTemplateElement
newChild
- Child to add to child list
DOMException
int findAncestor(XPathContext xctxt, XPath fromMatchPattern, XPath countMatchPattern, int context, ElemNumber namespaceContext) throws javax.xml.transform.TransformerException
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.
javax.xml.transform.TransformerException
private int findPrecedingOrAncestorOrSelf(XPathContext xctxt, XPath fromMatchPattern, XPath countMatchPattern, int context, ElemNumber namespaceContext) throws javax.xml.transform.TransformerException
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.
javax.xml.transform.TransformerException
XPath getCountMatchPattern(XPathContext support, int contextNode) throws javax.xml.transform.TransformerException
support
- The XPath runtime state for this.contextNode
- The node that "." expresses.
javax.xml.transform.TransformerException
String getCountString(TransformerImpl transformer, int sourceNode) throws javax.xml.transform.TransformerException
transformer
- non-null reference to the the current transform-time state.sourceNode
- The source node being counted.
javax.xml.transform.TransformerException
public int getPreviousNode(XPathContext xctxt, int pos) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime state for this.pos
- The current node
javax.xml.transform.TransformerException
public int getTargetNode(XPathContext xctxt, int sourceNode) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime state for this.sourceNode
- non-null reference to the current source node.
javax.xml.transform.TransformerException
NodeVector getMatchingAncestors(XPathContext xctxt, int node, boolean stopAtFirstFound) throws javax.xml.transform.TransformerException
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)
javax.xml.transform.TransformerException
Locale getLocale(TransformerImpl transformer, int contextNode) throws javax.xml.transform.TransformerException
transformer
- non-null reference to the the current transform-time state.contextNode
- The node that "." expresses.
javax.xml.transform.TransformerException
private DecimalFormat getNumberFormatter(TransformerImpl transformer, int contextNode) throws javax.xml.transform.TransformerException
transformer
- non-null reference to the the current transform-time state.contextNode
- The node that "." expresses.
($objectName$) @return The number formatter to be used
javax.xml.transform.TransformerException
String formatNumberList(TransformerImpl transformer, long[] list, int contextNode) throws javax.xml.transform.TransformerException
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.
javax.xml.transform.TransformerException
private void getFormattedNumber(TransformerImpl transformer, int contextNode, char numberType, int numberWidth, long listElement, FastStringBuffer formattedNumber) throws javax.xml.transform.TransformerException
transformer
- non-null reference to the the current transform-time state.contextNode
- The node that "." expresses.numberType
- Type to format tonumberWidth
- Maximum length of formatted numberlistElement
- Number to formatformattedNumber
- Buffer to store formatted number
javax.xml.transform.TransformerException
String getZeroString()
protected String int2singlealphaCount(long val, char[] table)
val
- Value to convert -- must be greater than zero.table
- a table containing one character for each digit in the radix
Note that the radix of the conversion is inferred from the size
of the table.
protected void int2alphaCount(long val, char[] aTable, FastStringBuffer stringBuf)
val
- Value to convert -- must be greater than zero.aTable
- Array of alpha characters representing numbersstringBuf
- Buffer where to save the string representing alpha count of number.Note that the radix of the conversion is inferred from the size
of the table.
protected String tradAlphaCount(long val, XResourceBundle thisBundle)
val
- Value to convert -- must be greater than zero.thisBundle
- Resource bundle to use
Note that the radix of the conversion is inferred from the size
of the table.
protected String long2roman(long val, boolean prefixesAreOK)
val
- Value to convert.prefixesAreOK
- true_ to enable prefix notation (e.g. 4 = "IV"),
false_ to disable prefix notation (e.g. 4 = "IIII").
DecimalToRoman
,
m_romanConvertTable
public void callChildVisitors(XSLTVisitor visitor, boolean callAttrs)
callChildVisitors
in class ElemTemplateElement
visitor
- The visitor whose appropriate method will be called.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |