## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.10

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# ElemNumber Class Reference

`#include <ElemNumber.hpp>`

Inheritance diagram for ElemNumber:

[legend]
Collaboration diagram for ElemNumber:

[legend]
List of all members.

## Public Types

- typedef CountersTable::CountType CountType
- typedef XalanVector<CountType> CountTypeArrayType
- enum eLevel { eSingle, eMultiple, eAny }

## Public Methods

- ElemNumber (StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, const AttributeListType &atts, int lineNumber, int columnNumber, unsigned long id)
    Construct an object corresponding to an "xsl:number" element. More...
- virtual ~ElemNumber ()
- virtual const XalanDOMString& getElementName () const
    Get a string for the name of the element. More...
- virtual const ElemTemplateElement* startElement (StylesheetExecutionContext &executionContext) const
    Completes "pre-processing" before any sub-elements are invoked (i.e. More...
- unsigned long getID () const
- XalanNode* getPreviousNode (StylesheetExecutionContext &executionContext, XalanNode *pos) const
    Get the previous node to be counted. More...
- XalanNode* getTargetNode (StylesheetExecutionContext &executionContext, XalanNode *sourceNode) const
    Get the target node that will be counted.. More...
- virtual const XPath* getXPath (unsigned int index=0) const
    Get XPath pattern/expression of one of the element atribute. More...

## Static Public Methods

- void initialize (MemoryManagerType &theManager)
    Perform static initialization. More...
- void terminate ()
    Perform static shut down. More...
- ElemNumber* create (MemoryManagerType &theManager, StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, const AttributeListType &atts, int lineNumber, int columnNumber, unsigned long id)

## Protected Methods

- XalanNode* findAncestor (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...
- XalanNode* findPrecedingOrAncestorOrSelf (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 XPath* getCountMatchPattern (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...
- XalanNumberFormat* getNumberFormatter (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...

## Static Protected Methods

- 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...
- 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...
- void toRoman (CountType val, bool prefixesAreOK, XalanDOMString &theResult)
    Convert an integral into roman numerals. More...

## Member Typedef Documentation

typedef CountersTable::CountType ElemNumber::CountType

typedef XalanVector< CountType > ElemNumber::CountTypeArrayType<CountType>

## Member Enumeration Documentation

enum ElemNumber::eLevel

Enumeration values:

  eSingle |
  eMultiple |
  eAny |

## Constructor & Destructor Documentation

ElemNumber::ElemNumber ( | StylesheetConstructionContext & constructionContext,
| Stylesheet & stylesheetTree,
| const AttributeListType & atts,
| int lineNumber,
| int columnNumber,
| unsigned long id )

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

Parameters:

  constructionContext | context for construction of object
  stylesheetTree | stylesheet containing element
  atts | list of attributes for element
  lineNumber | line number in document
  columnNumber | column number in document
  id | The unique ID within the stylesheet for this xsl:number element

ElemNumber::~ElemNumber ( | )`[virtual]`

## Member Function Documentation

ElemNumber * ElemNumber::create ( | MemoryManagerType & theManager,
| StylesheetConstructionContext & constructionContext,
| Stylesheet & stylesheetTree,
| const AttributeListType & atts,
| int lineNumber,
| int columnNumber,
| unsigned long id )`[static]`

XalanNode * 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:

  executionContext | The current execution context
  matchPatternString | The match pattern.
  matchPatternString | The count match pattern.
  node | The context node

Returns:
  A pointer to the matched node.

XalanNode * 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:

  executionContext | The current execution context
  matchPatternString | The match pattern.
  matchPatternString | The count match pattern.
  node | The context node

Returns:
  A pointer to the matched node.

void 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:

  executionContext | The current execution context.
  theList | Array of one or more integer numbers.
  theListLength | The length of the array.
  formattedNumber | The formatted number result.

const XPath * ElemNumber::getCountMatchPattern ( | StylesheetExecutionContext & executionContext,
| XalanNode * contextNode ) const`[protected]`

| Get the count match pattern, or a default value.

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

void 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.

const XalanDOMString & 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.

Reimplemented from ElemTemplateElement.

unsigned long ElemNumber::getID ( | ) const

void ElemNumber::getMatchingAncestors ( | StylesheetExecutionContext & executionContext,
| XalanNode * node,
| bool stopAtFirstFound,
| MutableNodeRefList & ancestors ) const`[protected]`

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

Parameters:

  patterns | if non-0, count only nodes that match this pattern, if 0 count all ancestors.
  executionContext | The current execution context.
  node | Count this node and it's ancestors.
  stopAtFirstFound | If true, only get the first matching ancestor
  ancestors | The ancestors that match the pattern.

XalanNumberFormat * ElemNumber::getNumberFormatter ( | StylesheetExecutionContext & executionContext ) const`[protected]`

Get a formatter.

Parameters:

  executionContext | The current execution context.

Returns:
  A new XalanNumberFormat instance. The caller owns the memory.

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

| Get the previous node to be counted.

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

| Get the target node that will be counted..

const XPath * ElemNumber::getXPath ( | unsigned int index = 0 ) 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 ElemTemplateElement.

void ElemNumber::initialize ( | MemoryManagerType & theManager )`[static]`

| Perform static initialization. See class XSLTInit.

void ElemNumber::int2alphaCount ( | CountType val,
| const XalanDOMChar table[],
| XalanDOMString::size_type length,
| XalanDOMString & theResult )`[static, protected]`

Convert an integral 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
  length | the table length
  result | returns 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.

void ElemNumber::int2singlealphaCount ( | CountType val,
| const XalanDOMString & table,
| XalanDOMString & theResult )`[static, protected]`

Convert an intergral 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
  theResult | A 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.

const ElemTemplateElement * 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:

  executionContext | context to execute this element

Reimplemented from ElemTemplateElement.

void ElemNumber::terminate ( | )`[static]`

| Perform static shut down. See class XSLTInit.

void ElemNumber::toRoman ( | CountType val,
| bool prefixesAreOK,
| XalanDOMString & theResult )`[static, protected]`

Convert an integral 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").
  theResult | The formatted Roman numeral string.

See also:
  DecimalToRoman , m_romanConvertTable

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

- ElemNumber.hpp

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.10 Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.