Xalan-C++ API Reference  1.12.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
xalanc::ElemNumber Class Reference

#include <xalanc/XSLT/ElemNumber.hpp>

Inheritance diagram for xalanc::ElemNumber:
[legend]
Collaboration diagram for xalanc::ElemNumber:
[legend]

Classes

class  NumberFormatStringTokenizer
 This class returns tokens using non-alphanumberic characters as delimiters. More...
 

Public Types

enum  eLevel { eSingle, eMultiple, eAny }
 
typedef CountersTable::CountType CountType
 
typedef XalanVector< CountTypeCountTypeArrayType
 

Public Member Functions

 ElemNumber (StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, const AttributeListType &atts, XalanFileLoc lineNumber, XalanFileLoc columnNumber, unsigned long id)
 Construct an object corresponding to an "xsl:number" element. More...
 
virtual ~ElemNumber ()
 
virtual const XalanDOMStringgetElementName () const
 Get a string for the name of the element. More...
 
virtual const ElemTemplateElementstartElement (StylesheetExecutionContext &executionContext) const
 Completes "pre-processing" before any sub-elements are invoked (i.e. More...
 
unsigned long getID () const
 
XalanNodegetPreviousNode (StylesheetExecutionContext &executionContext, XalanNode *pos) const
 Get the previous node to be counted. More...
 
XalanNodegetTargetNode (StylesheetExecutionContext &executionContext, XalanNode *sourceNode) const
 Get the target node that will be counted. More...
 
virtual const XPathgetXPath (XalanSize_t index) const
 Get XPath pattern/expression of one of the element atribute. More...
 
- Public Member Functions inherited from xalanc::ElemTemplateElement
 ElemTemplateElement (StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, XalanFileLoc lineNumber, XalanFileLoc columnNumber, int xslToken)
 Construct a template element instance. More...
 
 ElemTemplateElement (StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, int xslToken, const XalanDOMString &baseURI=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), XalanFileLoc lineNumber=XalanLocator::getUnknownValue(), XalanFileLoc columnNumber=XalanLocator::getUnknownValue())
 Special constructor used by dummy elements which do not exist in the final stylesheet. More...
 
virtual ~ElemTemplateElement ()
 
virtual const Locator * getLocator () const
 Get the Locator for the node. More...
 
virtual bool isAttrOK (const XalanDOMChar *attrName, const AttributeListType &atts, XalanSize_t which, StylesheetConstructionContext &constructionContext) const
 See if this is a xmlns attribute or in a non-XSLT. More...
 
bool processSpaceAttr (const XalanDOMChar *elementName, const XalanDOMChar *aname, const AttributeListType &atts, XalanSize_t which, StylesheetConstructionContext &constructionContext)
 Tell whether or not this is a xml:space attribute and, if so, process it. More...
 
virtual void endElement (StylesheetExecutionContext &executionContext) const
 Completes "post-processing" afer any sub-elements are invoked (i.e. More...
 
virtual void execute (StylesheetExecutionContext &executionContext) const
 Execute the element. More...
 
virtual void executeChildren (StylesheetExecutionContext &executionContext) const
 Execute the children of this element. More...
 
virtual const ElemTemplateElementgetInvoker (StylesheetExecutionContext &executionContext) const
 Returns the element that invoked this element. More...
 
int getXSLToken () const
 
virtual bool isWhitespace () const
 Tell if the element will generate text which is XML whitespace. More...
 
virtual const XalanQNamegetNameAttribute () const
 Get the QName associated with any name attribute of this element. More...
 
virtual void addToStylesheet (StylesheetConstructionContext &constructionContext, Stylesheet &theStylesheet)
 Called during compilation when an instance is not parented by another element, and thus, is a child of the stylesheet. More...
 
virtual void processSortElement (StylesheetConstructionContext &constructionContext, Stylesheet &theStylesheet, const AttributeListType &atts, const Locator *locator=0)
 Called during compilation to process xsl:sort elements in the stylesheet. More...
 
virtual void setDefaultTemplate (bool value)
 Sets a flag indicating this is the default template. More...
 
const NamespacesHandlergetNamespacesHandler () const
 Get the namespaces handler for this element. More...
 
const StylesheetgetStylesheet () const
 Retrieve the stylesheet from which this element comes. More...
 
void setFinishedConstruction (bool fValue)
 Set the flag indicating construction of the element is completed. More...
 
bool getFinishedConstruction () const
 Get the flag indicating construction of the element is completed. More...
 
virtual void postConstruction (StylesheetConstructionContext &constructionContext, const NamespacesHandler &theParentHandler)
 Called after construction is completed. More...
 
virtual ElemTemplateElementgetFirstChildElem () const
 Get the first child. More...
 
virtual const ElemTemplateElementbeginExecuteChildren (StylesheetExecutionContext &executionContext) const
 Method to initiate the execution of the element's children. More...
 
virtual void endExecuteChildren (StylesheetExecutionContext &executionContext) const
 Method to indicate the execution of the element's children is complete. More...
 
const ElemTemplateElementbeginChildrenToString (StylesheetExecutionContext &executionContext, XalanDOMString &result) const
 Method to initiate output from the children to a string. More...
 
void endChildrenToString (StylesheetExecutionContext &executionContext) const
 Method to indicate string output from the children is complete. More...
 
virtual void setFirstChildElem (ElemTemplateElement *theChild)
 Set the first child. More...
 
virtual ElemTemplateElementgetLastChildElem () const
 Get the last child. More...
 
virtual ElemTemplateElementgetNextSiblingElem () const
 Get the next sibling. More...
 
virtual const ElemTemplateElementgetNextChildElemToExecute (StylesheetExecutionContext &executionContext, const ElemTemplateElement *currentElem) const
 Returns the next sub-element (i.e. More...
 
virtual const ElemTemplateElementgetFirstChildElemToExecute (StylesheetExecutionContext &executionContext) const
 Returns the first sub-element (i.e. More...
 
virtual bool executeChildElement (StylesheetExecutionContext &executionContext, const ElemTemplateElement *element) const
 Filters sub-elements that should be executed. More...
 
virtual void setNextSiblingElem (ElemTemplateElement *theSibling)
 Set the next sibling. More...
 
virtual ElemTemplateElementgetPreviousSiblingElem () const
 Get the previous sibling. More...
 
virtual void setPreviousSiblingElem (ElemTemplateElement *theSibling)
 Set the previous sibling. More...
 
virtual ElemTemplateElementgetParentNodeElem () const
 Get the parent node. More...
 
virtual void setParentNodeElem (ElemTemplateElement *theParent)
 Set the parent node. More...
 
virtual ElemTemplateElementappendChildElem (ElemTemplateElement *newChild)
 Append a child. More...
 
virtual const XalanDOMStringgetNamespaceForPrefix (const XalanDOMString &prefix) const
 Retrieve a namespace corresponding to a prefix. More...
 
virtual const XalanDOMStringgetURI () const
 Retrieve the base URI for the resolver. More...
 
XalanFileLoc getLineNumber () const
 
XalanFileLoc getColumnNumber () const
 
bool hasParams () const
 
bool hasVariables () const
 
bool hasSingleTextChild () const
 
bool hasChildren () const
 
bool hasDirectTemplate () const
 
bool canGenerateAttributes () const
 
bool isDefaultTemplate () const
 
- Public Member Functions inherited from xalanc::PrefixResolver
 PrefixResolver ()
 
 PrefixResolver (const PrefixResolver &)
 
virtual ~PrefixResolver ()
 

Static Public Member Functions

static void initialize (MemoryManager &theManager)
 Perform static initialization. More...
 
static void terminate ()
 Perform static shut down. More...
 
static ElemNumbercreate (MemoryManager &theManager, StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, const AttributeListType &atts, XalanFileLoc lineNumber, XalanFileLoc columnNumber, unsigned long id)
 
- Static Public Member Functions inherited from xalanc::ElemTemplateElement
static bool isValidNCName (const XalanDOMString &s)
 Validate that the string is an NCName. More...
 

Protected Member Functions

XalanNodefindAncestor (StylesheetExecutionContext &executionContext, const XPath *fromMatchPattern, const XPath *countMatchPattern, XalanNode *context) const
 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). More...
 
XalanNodefindPrecedingOrAncestorOrSelf (StylesheetExecutionContext &executionContext, const XPath *fromMatchPattern, const XPath *countMatchPattern, XalanNode *context) const
 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). More...
 
const XPathgetCountMatchPattern (StylesheetExecutionContext &executionContext, XalanNode *contextNode) const
 Get the count match pattern, or a default value. More...
 
void getCountString (StylesheetExecutionContext &executionContext, XalanDOMString &theResult) const
 Given an XML source node, get the count according to the parameters set up by the xsl:number attributes. More...
 
void getCountString (StylesheetExecutionContext &executionContext, const MutableNodeRefList &ancestors, CountersTable &ctable, CountType numberList[], NodeRefListBase::size_type numberListLength, XalanDOMString &theResult) const
 
void getMatchingAncestors (StylesheetExecutionContext &executionContext, XalanNode *node, bool stopAtFirstFound, MutableNodeRefList &ancestors) const
 Get the ancestors, up to the root, that match the pattern. More...
 
XalanNumberFormatgetNumberFormatter (StylesheetExecutionContext &executionContext) const
 Get a formatter. More...
 
void formatNumberList (StylesheetExecutionContext &executionContext, const CountType theList[], NodeRefListBase::size_type theListLength, XalanDOMString &formattedNumber) const
 Format an array of integrals into a formatted string. More...
 
- Protected Member Functions inherited from xalanc::ElemTemplateElement
void canGenerateAttributes (bool value)
 
void hasPrefix (bool value)
 
bool hasPrefix () const
 
void preserveSpace (bool value)
 
bool preserveSpace () const
 
void disableOutputEscaping (bool value)
 
bool disableOutputEscaping () const
 
bool processPrefixControl (StylesheetConstructionContext &constructionContext, const Stylesheet &stylesheetTree, const XalanDOMString &localName, const XalanDOMChar *attrValue)
 Process the exclude-result-prefixes or the extension-element-prefixes attributes, for the purpose of prefix exclusion. More...
 
const XalanDOMStringgetNamespaceForPrefixInternal (const XalanDOMString &prefix) const
 Get the namespace for a given prefix. More...
 
virtual const ElemTemplateElementfindTemplateToTransformChild (StylesheetExecutionContext &executionContext, const ElemTemplateElement &xslInstruction, const ElemTemplateElement *theTemplate, XalanNode *child) const
 Given an element, find the corresponding template. More...
 
virtual const ElemTemplateElementfindTemplateToTransformChild (StylesheetExecutionContext &executionContext, const ElemTemplateElement &xslInstruction, const ElemTemplateElement *theTemplate, XalanNode *child, XalanNode::NodeType nodeType) const
 Given an element, find the corresponding template. More...
 
virtual bool childTypeAllowed (int xslToken) const
 Given an xsl token type, determine whether or not a child of that type is allowed. More...
 
virtual void namespacesPostConstruction (StylesheetConstructionContext &constructionContext, const NamespacesHandler &theParentHandler, NamespacesHandler &theHandler)
 Called after construction is completed. More...
 
const NamespacesHandlergetNamespaces () const
 
void error (StylesheetExecutionContext &theContext, XalanMessages::Codes theCode) const
 A convenience function for loading a message and reporting an error through the provided StylesheetExecutionContext instance. More...
 
void error (StylesheetExecutionContext &theContext, XalanMessages::Codes theCode, const XalanDOMString &theToken) const
 A convenience function for loading a message and reporting an error through the provided StylesheetExecutionContext instance. More...
 
void error (StylesheetExecutionContext &theContext, XalanMessages::Codes theCode, const Locator *theLocator) const
 A convenience function for loading a message and reporting an error through the provided StylesheetExecutionContext instance. More...
 
void warn (StylesheetExecutionContext &theContext, XalanMessages::Codes theCode) const
 A convenience function for loading a message and reporting a warning through the provided StylesheetExecutionContext instance. More...
 
void warn (StylesheetExecutionContext &theContext, XalanMessages::Codes theCode, const XalanDOMString &theToken) const
 A convenience function for loading a message and reporting a warning through the provided StylesheetExecutionContext instance. More...
 
void warn (StylesheetExecutionContext &theContext, XalanMessages::Codes theCode, const Locator *theLocator) const
 A convenience function for loading a message and reporting a warning through the provided StylesheetExecutionContext instance. More...
 
void error (StylesheetConstructionContext &theContext, XalanMessages::Codes theCode)
 A convenience function for loading a message and reporting an error through the provided StylesheetConstructionContext instance. More...
 
void error (StylesheetConstructionContext &theContext, XalanMessages::Codes theCode, const XalanDOMString &theToken)
 A convenience function for loading a message and reporting an error through the provided StylesheetConstructionContext instance. More...
 
void error (StylesheetConstructionContext &theContext, XalanMessages::Codes theCode, const XalanDOMString &theToken, const Locator *theLocator)
 A convenience function for loading a message and reporting an error through the provided StylesheetConstructionContext instance. More...
 
void error (StylesheetConstructionContext &theContext, XalanMessages::Codes theCode, const XalanDOMString &theToken1, const XalanDOMString &theToken2)
 A convenience function for loading a message and reporting an error through the provided StylesheetConstructionContext instance. More...
 
void error (StylesheetConstructionContext &theContext, XalanMessages::Codes theCode, const XalanDOMChar *theToken1, const XalanDOMChar *theToken2)
 A convenience function for loading a message and reporting an error through the provided StylesheetConstructionContext instance. More...
 
void error (StylesheetConstructionContext &theContext, XalanMessages::Codes theCode, const XalanDOMChar *theToken1, const XalanDOMChar *theToken2, const XalanDOMChar *theToken3)
 A convenience function for loading a message and reporting an error through the provided StylesheetConstructionContext instance. More...
 
void warn (StylesheetConstructionContext &theContext, XalanMessages::Codes theCode, const XalanDOMChar *theToken1, const XalanDOMChar *theToken2, const XalanDOMChar *theToken3)
 A convenience function for loading a message and reporting a warning through the provided StylesheetConstructionContext instance. More...
 

Static Protected Member Functions

static void int2singlealphaCount (CountType val, const XalanDOMString &table, XalanDOMString &theResult)
 Convert an intergral into alphabetic counting, in other words count using the sequence A B C ... More...
 
static void int2alphaCount (CountType val, const XalanDOMChar table[], XalanDOMString::size_type length, XalanDOMString &theResult)
 Convert an integral into alphabetic counting, in other words count using the sequence A B C ... More...
 
static void toRoman (CountType val, bool prefixesAreOK, XalanDOMString &theResult)
 Convert an integral into roman numerals. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from xalanc::ElemTemplateElement
static const XalanDOMString s_emptyString
 

Detailed Description

Definition at line 59 of file ElemNumber.hpp.

Member Typedef Documentation

◆ CountType

Definition at line 63 of file ElemNumber.hpp.

◆ CountTypeArrayType

Definition at line 72 of file ElemNumber.hpp.

Member Enumeration Documentation

◆ eLevel

Enumerator
eSingle 
eMultiple 
eAny 

Definition at line 65 of file ElemNumber.hpp.

Constructor & Destructor Documentation

◆ ElemNumber()

xalanc::ElemNumber::ElemNumber ( StylesheetConstructionContext constructionContext,
Stylesheet stylesheetTree,
const AttributeListType atts,
XalanFileLoc  lineNumber,
XalanFileLoc  columnNumber,
unsigned long  id 
)

Construct an object corresponding to an "xsl:number" element.

Parameters
constructionContextcontext for construction of object
stylesheetTreestylesheet containing element
attslist of attributes for element
lineNumberline number in document
columnNumbercolumn number in document
idThe unique ID within the stylesheet for this xsl:number element

◆ ~ElemNumber()

virtual xalanc::ElemNumber::~ElemNumber ( )
virtual

Member Function Documentation

◆ create()

static ElemNumber* xalanc::ElemNumber::create ( MemoryManager &  theManager,
StylesheetConstructionContext constructionContext,
Stylesheet stylesheetTree,
const AttributeListType atts,
XalanFileLoc  lineNumber,
XalanFileLoc  columnNumber,
unsigned long  id 
)
static

◆ findAncestor()

XalanNode* xalanc::ElemNumber::findAncestor ( StylesheetExecutionContext executionContext,
const XPath fromMatchPattern,
const XPath countMatchPattern,
XalanNode context 
) const
protected

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
executionContextThe current execution context
matchPatternStringThe match pattern.
matchPatternStringThe count match pattern.
nodeThe context node
Returns
A pointer to the matched node.

◆ findPrecedingOrAncestorOrSelf()

XalanNode* xalanc::ElemNumber::findPrecedingOrAncestorOrSelf ( StylesheetExecutionContext executionContext,
const XPath fromMatchPattern,
const XPath countMatchPattern,
XalanNode context 
) const
protected

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
executionContextThe current execution context
matchPatternStringThe match pattern.
matchPatternStringThe count match pattern.
nodeThe context node
Returns
A pointer to the matched node.

◆ formatNumberList()

void xalanc::ElemNumber::formatNumberList ( StylesheetExecutionContext executionContext,
const CountType  theList[],
NodeRefListBase::size_type  theListLength,
XalanDOMString formattedNumber 
) const
protected

Format an array of integrals into a formatted string.

Parameters
executionContextThe current execution context.
theListArray of one or more integer numbers.
theListLengthThe length of the array.
formattedNumberThe formatted number result.

◆ getCountMatchPattern()

const XPath* xalanc::ElemNumber::getCountMatchPattern ( StylesheetExecutionContext executionContext,
XalanNode contextNode 
) const
protected

Get the count match pattern, or a default value.

◆ getCountString() [1/2]

void xalanc::ElemNumber::getCountString ( StylesheetExecutionContext executionContext,
const MutableNodeRefList ancestors,
CountersTable ctable,
CountType  numberList[],
NodeRefListBase::size_type  numberListLength,
XalanDOMString theResult 
) const
protected

◆ getCountString() [2/2]

void xalanc::ElemNumber::getCountString ( StylesheetExecutionContext executionContext,
XalanDOMString theResult 
) const
protected

Given an XML source node, get the count according to the parameters set up by the xsl:number attributes.

◆ getElementName()

virtual const XalanDOMString& xalanc::ElemNumber::getElementName ( ) const
virtual

Get a string for the name of the element.

Useful for debugging purposes, and error reporting.

Returns
A string containing the name of the element.

Implements xalanc::ElemTemplateElement.

◆ getID()

unsigned long xalanc::ElemNumber::getID ( ) const
inline

Definition at line 131 of file ElemNumber.hpp.

◆ getMatchingAncestors()

void xalanc::ElemNumber::getMatchingAncestors ( StylesheetExecutionContext executionContext,
XalanNode node,
bool  stopAtFirstFound,
MutableNodeRefList ancestors 
) const
protected

Get the ancestors, up to the root, that match the pattern.

Parameters
patternsif non-0, count only nodes that match this pattern, if 0 count all ancestors.
executionContextThe current execution context.
nodeCount this node and it's ancestors.
stopAtFirstFoundIf true, only get the first matching ancestor
ancestorsThe ancestors that match the pattern.

◆ getNumberFormatter()

XalanNumberFormat* xalanc::ElemNumber::getNumberFormatter ( StylesheetExecutionContext executionContext) const
protected

Get a formatter.

Parameters
executionContextThe current execution context.
Returns
A new XalanNumberFormat instance. The caller owns the memory.

◆ getPreviousNode()

XalanNode* xalanc::ElemNumber::getPreviousNode ( StylesheetExecutionContext executionContext,
XalanNode pos 
) const

Get the previous node to be counted.

◆ getTargetNode()

XalanNode* xalanc::ElemNumber::getTargetNode ( StylesheetExecutionContext executionContext,
XalanNode sourceNode 
) const

Get the target node that will be counted.

◆ getXPath()

virtual const XPath* xalanc::ElemNumber::getXPath ( XalanSize_t  index) const
virtual

Get XPath pattern/expression of one of the element atribute.

@index number of the attribute. If an attribute has more then one attribute with pattern/expression,the order of the returned expressions are undefined

Returns
pointer or null

Reimplemented from xalanc::ElemTemplateElement.

◆ initialize()

static void xalanc::ElemNumber::initialize ( MemoryManager &  theManager)
static

Perform static initialization.

See class XSLTInit.

◆ int2alphaCount()

static void xalanc::ElemNumber::int2alphaCount ( CountType  val,
const XalanDOMChar  table[],
XalanDOMString::size_type  length,
XalanDOMString theResult 
)
staticprotected

Convert an integral into alphabetic counting, in other words count using the sequence A B C ...

Z AA AB AC.... etc.

Parameters
valValue to convert – must be greater than zero.
tablea table containing one character for each digit in the radix
lengththe table length
resultreturns the stringrepresenting alpha count of number.
See also
XSLTEngineImpl::DecimalToRoman

Note that the radix of the conversion is inferred from the size of the table.

◆ int2singlealphaCount()

static void xalanc::ElemNumber::int2singlealphaCount ( CountType  val,
const XalanDOMString table,
XalanDOMString theResult 
)
staticprotected

Convert an intergral into alphabetic counting, in other words count using the sequence A B C ...

Z.

Parameters
valValue to convert – must be greater than zero.
tablea table containing one character for each digit in the radix
theResultA string representing alpha count of number.
See also
XSLTEngineImpl::DecimalToRoman

Note that the radix of the conversion is inferred from the size of the table.

◆ startElement()

virtual const ElemTemplateElement* xalanc::ElemNumber::startElement ( StylesheetExecutionContext executionContext) const
virtual

Completes "pre-processing" before any sub-elements are invoked (i.e.

children, attribute sets and templates). If there are no sub-elements it executes the primary function of the element.

Parameters
executionContextcontext to execute this element

Reimplemented from xalanc::ElemTemplateElement.

◆ terminate()

static void xalanc::ElemNumber::terminate ( )
static

Perform static shut down.

See class XSLTInit.

◆ toRoman()

static void xalanc::ElemNumber::toRoman ( CountType  val,
bool  prefixesAreOK,
XalanDOMString theResult 
)
staticprotected

Convert an integral into roman numerals.

Parameters
valValue to convert.
prefixesAreOKtrue to enable prefix notation (e.g. 4 = "IV"), false to disable prefix notation (e.g. 4 = "IIII").
theResultThe formatted Roman numeral string.
See also
DecimalToRoman
m_romanConvertTable

The documentation for this class was generated from the following file: