Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Stylesheet Class Reference

This class represents the base stylesheet or an "import" stylesheet. More...

Inheritance diagram for Stylesheet:
PrefixResolver StylesheetRoot

Public Types

typedef
StylesheetConstructionContext::size_type 
size_type
typedef
StylesheetExecutionContext::ParamVectorType 
ParamVectorType
typedef
XalanQName::NamespaceVectorType 
NamespaceVectorType
typedef
XalanQName::NamespacesStackType 
NamespacesStackType
typedef XalanVector
< ElemVariable * > 
ElemVariableVectorType
typedef XalanVector
< KeyDeclaration
KeyDeclarationVectorType
typedef XalanVector< Stylesheet * > StylesheetVectorType
typedef XalanVector
< XalanDOMString
URLStackType
typedef XalanVector
< ElemDecimalFormat * > 
ElemDecimalFormatVectorType
typedef XalanVector
< XalanSpaceNodeTester
WhitespaceElementsVectorType
typedef PatternTableVectorTypeDecl PatternTableVectorType
typedef XalanMap
< XalanDOMString,
ExtensionNSHandler * > 
ExtensionNamespacesMapType
typedef XalanMap
< XalanQNameByReference, const
ElemTemplate * > 
ElemTemplateMapType
typedef XalanMap< const
XalanNode *, KeyTable * > 
KeyTablesTableType
typedef XalanMap
< XalanDOMString,
PatternTableVectorType
PatternTableMapType
typedef
StylesheetConstructionContext::GetAndReleaseCachedString 
GetAndReleaseCachedString

Public Member Functions

 Stylesheet (StylesheetRoot &root, const XalanDOMString &baseIdentifier, StylesheetConstructionContext &constructionContext)
 Constructor for a Stylesheet needs a Document.
virtual ~Stylesheet ()
MemoryManagerTypegetMemoryManager ()
double getXSLTVerDeclared () const
 Retrieve XSLT version number.
void setXSLTVerDeclared (double ver)
 Set XSLT version number.
const StylesheetRootgetStylesheetRoot () const
 Retrieve the root stylesheet object.
StylesheetRootgetStylesheetRoot ()
 Retrieve the root stylesheet object.
const NamespacesStackTypegetNamespaces () const
 Retrieve the stack of namespace lists.
NamespacesStackTypegetNamespaces ()
 Retrieve the stack of namespace lists.
const NamespacesHandlergetNamespacesHandler () const
NamespacesHandlergetNamespacesHandler ()
const NamespaceVectorTypegetNamespaceDecls () const
 Retrieve the list of namespace declarations currently in effect.
NamespaceVectorTypegetNamespaceDecls ()
 Retrieve the list of namespace declarations currently in effect.
void setNamespaceDecls (const NamespaceVectorType &ns)
 Set the list of namespace declarations currently in effect.
void pushNamespaces (const AttributeListType &atts)
 Push the namespace declarations from the current attribute list onto the namespace stack.
void popNamespaces ()
 Pop a namespace declaration from the namespace stack.
void addWhitespaceElement (const XalanSpaceNodeTester &theTester)
virtual void postConstruction (StylesheetConstructionContext &constructionContext)
 Called after construction is completed.
bool isAttrOK (const XalanDOMChar *attrName, const AttributeListType &atts, int which, StylesheetConstructionContext &constructionContext) const
 See if this is a xmlns attribute, and, if so, process it.
const XalanDOMStringgetNamespaceFromStack (const XalanDOMString &nodeName, XalanDOMString &theBuffer) const
 Get the namespace from a qualified name.
const XalanDOMStringgetNamespaceFromStack (const XalanDOMChar *nodeName, XalanDOMString &theBuffer) const
 Get the namespace from a qualified name.
const XalanDOMStringgetNamespaceForPrefixFromStack (const XalanDOMString &prefix) const
 Get the namespace from a prefix by searching the stack of namespace lists.
const XalanDOMStringgetNamespaceForPrefixFromStack (const XalanDOMChar *prefix) const
 Get the namespace from a prefix by searching the stack of namespace lists.
const XalanDOMStringgetNamespaceForPrefix (const XalanDOMString &prefix, StylesheetConstructionContext &constructionContext) const
 Get the namespace for a prefix, and report an error if it wasn't found.
const XalanDOMStringgetNamespaceForPrefix (const XalanDOMChar *prefix, StylesheetConstructionContext &constructionContext) const
 Get the namespace for a prefix, and report an error if it wasn't found.
void processExcludeResultPrefixes (StylesheetConstructionContext &theConstructionContext, const XalanDOMChar *theValue)
 See if a namespace should be excluded.
void addTemplate (ElemTemplate *theTemplate, StylesheetConstructionContext &constructionContext)
 Add a template to the list of names templates.
bool getYesOrNo (const XalanDOMChar *aname, const XalanDOMChar *val, StylesheetConstructionContext &constructionContext) const
 Process an attribute that has the value of 'yes' or 'no'.
const XalanDOMStringgetBaseIdentifier () const
 Retrieve the base identifier with which this stylesheet is associated.
const XalanDOMStringgetCurrentIncludeBaseIdentifier () const
 Retrieve the base identifier for the most recently included stylesheet.
void processNSAliasElement (const XalanDOMChar *name, const AttributeListType &atts, StylesheetConstructionContext &constructionContext)
 Process an xsl:namespace-alias element.
void processDecimalFormatElement (StylesheetConstructionContext &constructionContext, const AttributeListType &atts, const LocatorType *locator=0)
 Process an xsl:decimal-format element.
const XalanDecimalFormatSymbolsgetDecimalFormatSymbols (const XalanQName &theQName) const
 Retrieve the XalanDecimalFormatSymbols instance associated with the QName.
void addImport (Stylesheet *theStylesheet)
 Add an imported stylesheet.
bool isWrapperless () const
 whether there is a wrapper template
ElemTemplateElementinitWrapperless (StylesheetConstructionContext &constructionContext, const LocatorType *locator)
URLStackTypegetIncludeStack ()
 Retrieve the stack of who's including who.
void processKeyElement (const PrefixResolver &nsContext, const AttributeListType &atts, const LocatorType *locator, StylesheetConstructionContext &constructionContext)
 Process the xsl:key element.
const ElemTemplatefindNamedTemplate (const XalanQName &qname) const
 Locate a template via the "name" attribute.
const ElemTemplatefindTemplate (StylesheetExecutionContext &executionContext, XalanNode *targetNode) const
 Given a target element, find the template that best matches in the given XSL document, according to the rules specified in the xsl draft.
const ElemTemplatefindTemplate (StylesheetExecutionContext &executionContext, XalanNode *targetNode, XalanNode::NodeType targetNodeType, const XalanQName &mode, bool onlyUseImports) const
 Given a target element, find the template that best matches in the given XSL document, according to the rules specified in the xsl draft.
const PatternTableVectorTypelocateElementMatchPatternDataList (const XalanDOMString &theName) const
 Given a name, locate the start of a list of possible templates that match that name.
const PatternTableVectorTypelocateAttributeMatchPatternDataList (const XalanDOMString &theName) const
 Given a name, locate the start of a list of possible templates that match that name.
const PatternTableVectorTypelocateMatchPatternDataList (const XalanNode &theNode, XalanNode::NodeType targetNodeType) const
 Given a XalanNode, locate the start of a list of possible templates that match it.
void processExtensionNamespace (StylesheetConstructionContext &theConstructionContext, const XalanDOMString &uri)
 Add an extension namespace handler.
ExtensionNSHandlerlookupExtensionNSHandler (const XalanDOMString &uri) const
 Return the handler for a given extension namespace.
void setTopLevelVariable (ElemVariable *var)
 Set a top level variable.
void pushTopLevelVariables (StylesheetExecutionContext &executionContext, const ParamVectorType &topLevelParams) const
 Set a list of top level variables in the specified execution context stylesheet.
virtual const XalanDOMStringgetNamespaceForPrefix (const XalanDOMString &prefix) const
 Retrieve a namespace corresponding to a prefix.
virtual const XalanDOMStringgetURI () const
 Retrieve the base URI for the resolver.
const XalanDOMStringgetXSLTNamespaceURI () const
void setXSLTNamespaceURI (const XalanDOMString &theURI)
const ElemTemplategetFirstTemplate () const

Static Public Member Functions

static Stylesheetcreate (MemoryManagerType &theManager, StylesheetRoot &root, const XalanDOMString &baseIdentifier, StylesheetConstructionContext &constructionContext)
static void addObjectIfNotFound (const XalanMatchPatternData *thePattern, PatternTableVectorType &theVector)
 Add object to vector of match patterns if not already there.
static void addObjectIfNotFound (const XalanMatchPatternData *thePattern, const XalanMatchPatternData *theArray[], unsigned int &theArraySize)
 Add object to array of match patterns if not already there.

Protected Attributes

StylesheetRootm_stylesheetRoot
 The root of the stylesheet tree.
XalanDOMString m_baseIdent
 The base URL of the XSL document.
KeyDeclarationVectorType m_keyDeclarations
 Table of KeyDeclaration objects, which are set by the xsl:key element.
WhitespaceElementsVectorType m_whitespaceElements

Static Protected Attributes

static const XalanQNameByReference s_emptyQName

Additional Inherited Members

- Protected Member Functions inherited from PrefixResolver
 PrefixResolver ()
 PrefixResolver (const PrefixResolver &)
virtual ~PrefixResolver ()

Detailed Description

This class represents the base stylesheet or an "import" stylesheet.

"include" stylesheets are combined with the including stylesheet.

Member Typedef Documentation

Constructor & Destructor Documentation

Stylesheet::Stylesheet ( StylesheetRoot root,
const XalanDOMString baseIdentifier,
StylesheetConstructionContext constructionContext 
)

Constructor for a Stylesheet needs a Document.

Exceptions
XSLProcessorExceptionthrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.
virtual Stylesheet::~Stylesheet ( )
virtual

Member Function Documentation

void Stylesheet::addImport ( Stylesheet theStylesheet)

Add an imported stylesheet.

Parameters
theStylesheetThe stylesheet to add.
static void Stylesheet::addObjectIfNotFound ( const XalanMatchPatternData thePattern,
PatternTableVectorType theVector 
)
static

Add object to vector of match patterns if not already there.

Parameters
thePatternpattern to add
theVectorvector of patterns to add to
static void Stylesheet::addObjectIfNotFound ( const XalanMatchPatternData thePattern,
const XalanMatchPatternData theArray[],
unsigned int &  theArraySize 
)
static

Add object to array of match patterns if not already there.

theArraySize size will be incremented if the pattern was added.

Parameters
thePatternpattern to add
theArrayvector of patterns to add to
theArraySizeThe size of the array
void Stylesheet::addTemplate ( ElemTemplate theTemplate,
StylesheetConstructionContext constructionContext 
)

Add a template to the list of names templates.

Parameters
theTemplatetemplate to add
constructionContextcontext for construction
void Stylesheet::addWhitespaceElement ( const XalanSpaceNodeTester theTester)
static Stylesheet* Stylesheet::create ( MemoryManagerType theManager,
StylesheetRoot root,
const XalanDOMString baseIdentifier,
StylesheetConstructionContext constructionContext 
)
static
const ElemTemplate* Stylesheet::findNamedTemplate ( const XalanQName qname) const

Locate a template via the "name" attribute.

Parameters
namequalified name of template
Returns
pointer to template found or 0 if none found
const ElemTemplate* Stylesheet::findTemplate ( StylesheetExecutionContext executionContext,
XalanNode targetNode 
) const

Given a target element, find the template that best matches in the given XSL document, according to the rules specified in the xsl draft.

Parameters
executionContextcurrent execution context
targetNodeelement that needs a rule
Returns
pointer to rule that best matches targetNode
const ElemTemplate* Stylesheet::findTemplate ( StylesheetExecutionContext executionContext,
XalanNode targetNode,
XalanNode::NodeType  targetNodeType,
const XalanQName mode,
bool  onlyUseImports 
) const

Given a target element, find the template that best matches in the given XSL document, according to the rules specified in the xsl draft.

Parameters
executionContextcurrent execution context
targetNodenode that needs a rule
targetNodeTypethe type of targetNode
modestring indicating the mode
onlyUseImportsonly use imports, do not use any templates from the stylesheet itself
Returns
pointer to rule that best matches targetElem
const XalanDOMString& Stylesheet::getBaseIdentifier ( ) const

Retrieve the base identifier with which this stylesheet is associated.

Returns
string for base identifier
const XalanDOMString& Stylesheet::getCurrentIncludeBaseIdentifier ( ) const

Retrieve the base identifier for the most recently included stylesheet.

This will return the same value as getBaseIdentifier(), if no include is being processed.

Returns
string for base identifier
const XalanDecimalFormatSymbols* Stylesheet::getDecimalFormatSymbols ( const XalanQName theQName) const

Retrieve the XalanDecimalFormatSymbols instance associated with the QName.

Parameters
theQNamethe QName for the lookup
Returns
a pointer to the matching instance, or 0 if none was found
const ElemTemplate* Stylesheet::getFirstTemplate ( ) const
URLStackType& Stylesheet::getIncludeStack ( )

Retrieve the stack of who's including who.

Returns
stack of includes
MemoryManagerType& Stylesheet::getMemoryManager ( )

Reimplemented in StylesheetRoot.

const NamespaceVectorType& Stylesheet::getNamespaceDecls ( ) const

Retrieve the list of namespace declarations currently in effect.

Returns
vector of namespace vectors
NamespaceVectorType& Stylesheet::getNamespaceDecls ( )

Retrieve the list of namespace declarations currently in effect.

Returns
vector of namespace vectors
const XalanDOMString* Stylesheet::getNamespaceForPrefix ( const XalanDOMString prefix,
StylesheetConstructionContext constructionContext 
) const

Get the namespace for a prefix, and report an error if it wasn't found.

Parameters
prefixprefix to search
constructionContextThe current construction context
Returns
namespace corresponding to prefix, or null if not found.
const XalanDOMString* Stylesheet::getNamespaceForPrefix ( const XalanDOMChar *  prefix,
StylesheetConstructionContext constructionContext 
) const

Get the namespace for a prefix, and report an error if it wasn't found.

Parameters
prefixprefix to search
constructionContextThe current construction context
Returns
namespace corresponding to prefix, or null if not found.
virtual const XalanDOMString* Stylesheet::getNamespaceForPrefix ( const XalanDOMString prefix) const
virtual

Retrieve a namespace corresponding to a prefix.

This assumes that the PrevixResolver holds its own namespace context, or is a namespace context itself.

Parameters
prefixPrefix to resolve
Returns
namespace that prefix resolves to, or null if prefix is not found

Implements PrefixResolver.

const XalanDOMString* Stylesheet::getNamespaceForPrefixFromStack ( const XalanDOMString prefix) const

Get the namespace from a prefix by searching the stack of namespace lists.

Parameters
prefixprefix to search
Returns
namespace corresponding to prefix, or null if not found.
const XalanDOMString* Stylesheet::getNamespaceForPrefixFromStack ( const XalanDOMChar *  prefix) const

Get the namespace from a prefix by searching the stack of namespace lists.

Parameters
prefixprefix to search
Returns
namespace corresponding to prefix, or null if not found.
const XalanDOMString* Stylesheet::getNamespaceFromStack ( const XalanDOMString nodeName,
XalanDOMString theBuffer 
) const

Get the namespace from a qualified name.

Parameters
nodeNamename of node
Returns
namespace string for node, or null if not found.
const XalanDOMString* Stylesheet::getNamespaceFromStack ( const XalanDOMChar *  nodeName,
XalanDOMString theBuffer 
) const

Get the namespace from a qualified name.

Parameters
nodeNamename of node
Returns
namespace string for node, or null if not found.
const NamespacesStackType& Stylesheet::getNamespaces ( ) const

Retrieve the stack of namespace lists.

Returns
vector of namespace vectors
NamespacesStackType& Stylesheet::getNamespaces ( )

Retrieve the stack of namespace lists.

Returns
vector of namespace vectors
const NamespacesHandler& Stylesheet::getNamespacesHandler ( ) const
NamespacesHandler& Stylesheet::getNamespacesHandler ( )
const StylesheetRoot& Stylesheet::getStylesheetRoot ( ) const

Retrieve the root stylesheet object.

Returns
const reference to the stylesheet object
StylesheetRoot& Stylesheet::getStylesheetRoot ( )

Retrieve the root stylesheet object.

Returns
reference to the stylesheet object
virtual const XalanDOMString& Stylesheet::getURI ( ) const
virtual

Retrieve the base URI for the resolver.

Returns
URI string

Implements PrefixResolver.

const XalanDOMString& Stylesheet::getXSLTNamespaceURI ( ) const
double Stylesheet::getXSLTVerDeclared ( ) const

Retrieve XSLT version number.

Returns
number representing XSLT version
bool Stylesheet::getYesOrNo ( const XalanDOMChar *  aname,
const XalanDOMChar *  val,
StylesheetConstructionContext constructionContext 
) const

Process an attribute that has the value of 'yes' or 'no'.

Parameters
anamename of attribute
valvalue
constructionContextcontext for construction
Returns
true if value equals string constant for "yes," false otherwise
ElemTemplateElement* Stylesheet::initWrapperless ( StylesheetConstructionContext constructionContext,
const LocatorType locator 
)
bool Stylesheet::isAttrOK ( const XalanDOMChar *  attrName,
const AttributeListType atts,
int  which,
StylesheetConstructionContext constructionContext 
) const

See if this is a xmlns attribute, and, if so, process it.

Parameters
attrNamequalified name of attribute
attsattribute list where the element comes from (not used at this time)
whichindex into the attribute list (not used at this time)
Returns
true if this is a namespace name
bool Stylesheet::isWrapperless ( ) const

whether there is a wrapper template

Returns
true is there is a wrapper
const PatternTableVectorType* Stylesheet::locateAttributeMatchPatternDataList ( const XalanDOMString theName) const

Given a name, locate the start of a list of possible templates that match that name.

If none match, then use the default list.

Parameters
theNameThe name to match
const PatternTableVectorType* Stylesheet::locateElementMatchPatternDataList ( const XalanDOMString theName) const

Given a name, locate the start of a list of possible templates that match that name.

If none match, then use the default list.

Parameters
theNameThe name to match
const PatternTableVectorType* Stylesheet::locateMatchPatternDataList ( const XalanNode theNode,
XalanNode::NodeType  targetNodeType 
) const

Given a XalanNode, locate the start of a list of possible templates that match it.

Parameters
XalanNodeThe node to match
ExtensionNSHandler* Stylesheet::lookupExtensionNSHandler ( const XalanDOMString uri) const

Return the handler for a given extension namespace.

Parameters
urithe URI of the extension namespace.
Returns
pointer to extension handler
void Stylesheet::popNamespaces ( )

Pop a namespace declaration from the namespace stack.

virtual void Stylesheet::postConstruction ( StylesheetConstructionContext constructionContext)
virtual

Called after construction is completed.

Reimplemented in StylesheetRoot.

void Stylesheet::processDecimalFormatElement ( StylesheetConstructionContext constructionContext,
const AttributeListType atts,
const LocatorType locator = 0 
)

Process an xsl:decimal-format element.

Parameters
elemDecimalFormatthe element
void Stylesheet::processExcludeResultPrefixes ( StylesheetConstructionContext theConstructionContext,
const XalanDOMChar *  theValue 
)

See if a namespace should be excluded.

Parameters
theConstructionContextthe current construction context.
theValuethe prefix of the namespace.
Returns
void Stylesheet::processExtensionNamespace ( StylesheetConstructionContext theConstructionContext,
const XalanDOMString uri 
)

Add an extension namespace handler.

This provides methods for calling an element extension as well as for function calls (which is passed on to XPath).

Parameters
constructionContextThe current construction context.
uriThe namespace URI of the extension.
void Stylesheet::processKeyElement ( const PrefixResolver nsContext,
const AttributeListType atts,
const LocatorType locator,
StylesheetConstructionContext constructionContext 
)

Process the xsl:key element.

Parameters
nsContextThe PrefixResolver instance for namespace prefixes.
attsThe attribute list for element. #param locator The Locator instance for error reporting, if any. May be 0.
constructionContextThe current construction context.
void Stylesheet::processNSAliasElement ( const XalanDOMChar *  name,
const AttributeListType atts,
StylesheetConstructionContext constructionContext 
)

Process an xsl:namespace-alias element.

Parameters
namethe element name.
attrsthe current attribute list
constructionContextthe active construction context
void Stylesheet::pushNamespaces ( const AttributeListType atts)

Push the namespace declarations from the current attribute list onto the namespace stack.

Parameters
attsattribute list constaining namespaces
void Stylesheet::pushTopLevelVariables ( StylesheetExecutionContext executionContext,
const ParamVectorType topLevelParams 
) const

Set a list of top level variables in the specified execution context stylesheet.

Parameters
executionContextcurrent execution context
topLevelParamslist of top level parameters
void Stylesheet::setNamespaceDecls ( const NamespaceVectorType ns)

Set the list of namespace declarations currently in effect.

Parameters
nsvector of namespace vectors
void Stylesheet::setTopLevelVariable ( ElemVariable var)

Set a top level variable.

Parameters
vartop-level variable declared with "xsl:variable" or xsl:param-variable.
void Stylesheet::setXSLTNamespaceURI ( const XalanDOMString theURI)
void Stylesheet::setXSLTVerDeclared ( double  ver)

Set XSLT version number.

Parameters
vernumber representing XSLT version

Member Data Documentation

XalanDOMString Stylesheet::m_baseIdent
protected

The base URL of the XSL document.

KeyDeclarationVectorType Stylesheet::m_keyDeclarations
protected

Table of KeyDeclaration objects, which are set by the xsl:key element.

StylesheetRoot& Stylesheet::m_stylesheetRoot
protected

The root of the stylesheet tree.

WhitespaceElementsVectorType Stylesheet::m_whitespaceElements
protected
const XalanQNameByReference Stylesheet::s_emptyQName
staticprotected

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

Interpreting class diagrams

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

dot

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

Apache Logo