Xalan-C++ API Documentation
Xalan-C++ API Documentation
The Xalan-C++ XSL Transformer Version 1.0
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members
XSLTEngineImpl Class Reference
It's the responsibility of the XSLTEngineImpl class, collaborating with the XML parser liaison, the DOM, and the XPath engine, to transform a source tree of nodes into a result tree according to instructions and templates specified by a stylesheet tree.
More...
#include <XSLTEngineImpl.hpp>
Inheritance diagram for XSLTEngineImpl:
Collaboration diagram for XSLTEngineImpl:
List of all members.
Public Types
Public Methods
- XSLTEngineImpl ( XMLParserLiaison& parserLiaison, XPathSupport& xpathSupport, XPathEnvSupport& xpathEnvSupport, DOMSupport& domSupport, XObjectFactory& xobjectFactory, XPathFactory& xpathFactory)
- Construct an XSL processor that can call back to a XML processor, so it can handle included files, and the like. More...
- virtual ~XSLTEngineImpl ()
- virtual void process ( XSLTInputSource& inputSource, XSLTInputSource& stylesheetSource, XSLTResultTarget& outputTarget, StylesheetConstructionContext& constructionContext, StylesheetExecutionContext& executionContext)
- Transform the source tree to the output in the given result tree target. More...
- virtual void process ( XSLTInputSource& inputSource, XSLTResultTarget& outputTarget, StylesheetExecutionContext& executionContext)
- Transform the source tree to the output in the given result tree target. More...
- virtual StylesheetRoot* processStylesheet ( XSLTInputSource& stylesheetSource, StylesheetConstructionContext& constructionContext)
- Given a stylesheet input source, compile the stylesheet into an internal representation. More...
- virtual StylesheetRoot* processStylesheet ( const XalanDOMString& xsldocURLString, StylesheetConstructionContext& constructionContext)
- Given a URI to an XSL stylesheet, compile the stylesheet into an internal representation. More...
- virtual XalanNode* getSourceTreeFromInput (XSLTInputSource& inputSource)
- Given an input source, get the source tree. More...
- virtual void outputToResultTree ( StylesheetExecutionContext& executionContext, const XObject& xobj)
- Output an object to the result tree by doing the right conversions. More...
- virtual void resetCurrentState ( XalanNode* sourceTree, XalanNode* xmlNode)
- Reset the state of execution to node 'xmlNode' in source tree 'sourceTree.'. More...
- virtual XalanDOMString evaluateAttrVal ( XalanNode* contextNode, const PrefixResolver& namespaceContext, const XalanDOMString& stringedValue, XPathExecutionContext& executionContext)
- Evaluates attribute values for attribute templates (Stuff in curly {} braces that hold expressions). More...
- virtual ResultTreeFragBase* createResultTreeFrag ( StylesheetExecutionContext& executionContext, const ElemTemplateElement& templateChild, XalanNode* sourceTree, XalanNode* sourceNode, const QName& mode)
- Given a stylesheet element, create a result tree fragment from its contents. More...
- virtual ResultTreeFragBase* createResultTreeFrag () const
- Create an empty result tree fragment. More...
- virtual void resolveTopLevelParams (StylesheetExecutionContext& executionContext)
- Resolve the params that were pushed by the caller.
- virtual XMLParserLiaison& getXMLParserLiaison () const
- Get the XML Parser Liaison that this processor uses. More...
- virtual const XalanDOMString getUniqueNSValue () const
- Generate a random namespace prefix guaranteed to be unique. More...
- virtual void setStylesheetParam ( const XalanDOMString& key, const XalanDOMString& expression)
- Push a top-level stylesheet parameter. More...
- virtual void setStylesheetParam ( const XalanDOMString& key, XObject* value)
- Push a top-level stylesheet parameter. More...
- virtual bool shouldStripSourceNode ( XPathExecutionContext& executionContext, const XalanNode& node) const
- Tells, through the combination of the default-space attribute on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the xml:space attribute, whether or not extra whitespace should be stripped from the node. More...
- virtual FormatterListener* getFormatterListener () const
- Get the current formatter listener. More...
- virtual void setFormatterListener (FormatterListener* flistener)
- Set the current formatter listener. More...
- virtual unsigned long getTraceListeners () const
- Determine the number of trace listeners. More...
- virtual void addTraceListener (TraceListener* tl)
- Add a trace listener for the purposes of debugging and diagnosis. More...
- virtual void removeTraceListener (TraceListener* tl)
- Remove a trace listener. More...
- virtual void fireGenerateEvent (const GenerateEvent& ge)
- Fire a generate event. More...
- virtual void fireTraceEvent (const TracerEvent& te)
- Fire a trace event. More...
- virtual void fireSelectEvent (const SelectionEvent& se)
- Fire a selection event. More...
- virtual bool getTraceSelects () const
- If this is set to true, simple traces of template calls are made. More...
- virtual void setTraceSelects (bool b)
- virtual void traceSelect ( const XalanElement& theTemplate, const NodeRefListBase& nl) const
- Compose a diagnostic trace of the current selection. More...
- virtual void setQuietConflictWarnings (bool b)
- If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be printed to the diagnostics stream. More...
- virtual void setDiagnosticsOutput (PrintWriter* pw)
- If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream. More...
- XalanDocument* parseXML ( const XalanDOMString& urlString, DocumentHandler* docHandler, XalanDocument* docToRegister)
- Read in the XML file, either producing a Document or calling SAX events, and register the document in a table. More...
- Stylesheet* getStylesheetFromPIURL ( const XalanDOMString& xslURLString, XalanNode& fragBase, const XalanDOMString& xmlBaseIdent, bool isRoot, StylesheetConstructionContext& constructionContext)
- Reset the state of the XSL processor by reading in a new XSL stylesheet from a processing instruction. More...
- void flushPending ()
- Flush the pending element.
- void addResultNamespaceDecl ( const XalanDOMString& prefix, const XalanDOMString& namespaceVal)
- Add a namespace declaration to the namespace stack. More...
- void addResultAttribute ( AttributeListImpl& attList, const XalanDOMString& aname, const XalanDOMString& value)
- Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack. More...
- void addResultAttribute ( const XalanDOMString& aname, const XalanDOMString& value)
- Add attribute to pending attributes list, and if it is a namespace, add it to the namespaces stack. More...
- virtual void characters ( const XMLCh* const ch, const unsigned int start, const unsigned int length)
- Receive notification of character data. More...
- virtual void startElement ( const XMLCh* const name)
- Receive notification of the beginning of an element with an empty attribute list. More...
- virtual void charactersRaw ( const XMLCh* const ch, const unsigned int start, const unsigned int length)
- Receive notification of character data. More...
- virtual void comment ( const XMLCh* const data)
- Called when a Comment is to be constructed. More...
- virtual void entityReference ( const XMLCh* const data)
- Receive notification of a entityReference. More...
- virtual void cdata ( const XMLCh* const ch, const unsigned int start, const unsigned int length)
- Receive notification of cdata. More...
- void cloneToResultTree ( XalanNode& node, bool isLiteral, bool overrideStrip, bool shouldCloneAttributes)
- Clone an element with or without children. More...
- void outputResultTreeFragment ( StylesheetExecutionContext& executionContext, const XObject& theTree)
- Given a result tree fragment, walk the tree and output it to the result stream. More...
- virtual const StylesheetRoot* getStylesheetRoot () const
- Retrieve the root stylesheet. More...
- virtual void setStylesheetRoot (const StylesheetRoot* theStylesheet)
- Set the root stylesheet. More...
- virtual void setExecutionContext (StylesheetExecutionContext* theExecutionContext)
- Set the execution context. More...
- int getXSLToken (const XalanNode& node) const
- Given an XSL tag name, return an integer token that corresponds to ELEMNAME_XXX constants defined in Constants.java. More...
- bool isXSLTagOfType ( const XalanNode& node, int tagType) const
- Find the type of an element using this method. More...
- bool getQuietConflictWarnings () const
- Whether to warn about pattern match conflicts. More...
- virtual void message ( const XalanDOMString& msg, const XalanNode* styleNode = 0, const XalanNode* sourceNode = 0) const
- Give the user a message. More...
- virtual void warn ( const XalanDOMString& msg, const XalanNode* styleNode = 0, const XalanNode* sourceNode = 0) const
- Tell the user of an warning, and probably throw an exception. More...
- virtual void error ( const XalanDOMString& msg, const XalanNode* styleNode = 0, const XalanNode* sourceNode = 0) const
- Tell the user of an error, and probably throw an exception. More...
- void pushTime (const void* key) const
- Mark the time, so that displayDuration can later display the elapsed clock ticks. More...
- clock_t popDuration (const void* key) const
- Returns the duration since pushTime was called for element in milliseconds. More...
- void displayDuration ( const XalanDOMString& info, const void* key) const
- Display the duration since pushTime was called for element in milliseconds, and a descriptive message. More...
- bool doDiagnosticsOutput ()
- Whether diagnostic output is to be generated. More...
- void diag (const XalanDOMString& s) const
- Print a diagnostics string to the output device. More...
- bool isCDataResultElem (const XalanDOMString& elementName) const
- Tell if a given element name should output it's text as cdata. More...
- bool qnameEqualsResultElemName ( const QName& qname, const XalanDOMString& elementName) const
- Tell if a qualified name equals the current result tree name. More...
- const XalanDOMString& getResultNamespaceForPrefix (const XalanDOMString& prefix) const
- Retrieve the result namespace corresponding to a prefix. More...
- const XalanDOMString& getResultPrefixForNamespace (const XalanDOMString& theNamespace) const
- Retrieve the result prefix corresponding to a namespace. More...
- double evalMatchPatternStr ( const XalanDOMString& str, XalanNode* context, XPathExecutionContext& executionContext)
- Evaluate an xpath string and return the result as a numberic score. More...
- const XPath* createMatchPattern ( const XalanDOMString& str, const PrefixResolver& resolver)
- Create and initialize an xpath and return it. More...
- void returnXPath (const XPath* xpath)
- Return the xpath created by createXPath() or createMatchPattern(). More...
- void copyNamespaceAttributes ( const XalanNode& src, bool srcIsStylesheetTree)
- Copy XMLNS: attributes in if not already in scope. More...
- const XObject* evalXPathStr ( const XalanDOMString& str, XPathExecutionContext& executionContext)
- Evaluate an xpath string and return the result. More...
- const XObject* evalXPathStr ( const XalanDOMString& str, XalanNode* contextNode, const PrefixResolver& prefixResolver, XPathExecutionContext& executionContext)
- Evaluate an xpath string and return the result. More...
- const XObject* evalXPathStr ( const XalanDOMString& str, XalanNode* contextNode, const XalanElement& prefixResolver, XPathExecutionContext& executionContext)
- Evaluate an xpath string and return the result. More...
- XalanElement* getElementByID ( const XalanDOMString& id, const XalanDocument& doc) const
- Given a valid element id, return the corresponding element. More...
- XalanDOMString getAttrVal ( const XalanElement& el, const XalanDOMString& key, const XalanNode& contextNode)
- Given an element, return an attribute value in the form of a string. More...
- void copyAttributeToTarget ( const XalanAttr& attr, XalanNode* contextNode, const Stylesheet* stylesheetTree, AttributeListImpl& attrList, const XalanElement& namespaceContext)
- Copy an attribute to the created output element, executing attribute templates as need be, and processing the 'xsl:use' attribute. More...
- bool getStripWhiteSpace () const
- Determine the value of the default-space attribute. More...
- void setStripWhiteSpace (bool fStrip)
- Change the value of the default-space attribute. More...
- XalanDOMString fixWhiteSpace ( const XalanDOMString& string, bool trimHead, bool trimTail, bool doublePunctuationSpaces)
- Conditionally trim all leading and trailing whitespace in the specified String. More...
- void setOutputCarriageReturns (bool b)
- Control if carriage returns are put in the result tree. More...
- void setOutputLinefeeds (bool b)
- Control if linefeeds are put in the result tree. More...
- const XalanDOMString getNormalizedText (const XalanText& tx) const
- Normalize the linefeeds and/or carriage returns to be consistently 0x0D 0x0A. More...
- XPathFactory& getXPathFactory ()
- Get the factory for making xpaths. More...
- XPathProcessor& getXPathProcessor ()
- Get the XPath processor object. More...
- virtual void reset ()
- Reset the state. More...
- XPathSupport& getXPathSupport ()
- Retrieve the XPath support object. More...
- XPathEnvSupport& getXPathEnvSupport ()
- Retrieve the XPath environment support object. More...
- void setProblemListener (ProblemListener* l)
- Set the problem listener property. More...
- ProblemListener* getProblemListener () const
- Get the problem listener property. More...
- bool getHasPendingStartDocument () const
- void setHasPendingStartDocument (bool b)
- bool getMustFlushPendingStartDocument () const
- void setMustFlushPendingStartDocument (bool b)
- ResultTreeFragBase* createDocFrag () const
- Create a document fragment. More...
- AttributeListImpl& getPendingAttributes ()
- Retrieve list of attributes yet to be processed. More...
- const XalanDOMString getPendingElementName () const
- Retrieve name of the pending element currently being processed. More...
- void setPendingAttributes (const AttributeList& pendingAttributes)
- Sets a list of attributes yet to be processed. More...
- void setPendingElementName (const XalanDOMString& elementName)
- Changes the currently pending element name. More...
- const Locator* getLocatorFromStack () const
- Get the locator from the top of the locator stack. More...
- void pushLocatorOnStack (const Locator* locator)
- Push a locator on to the locator stack. More...
- void popLocatorStack ()
- Pop the locator from the top of the locator stack.
- virtual void setDocumentLocator (const Locator* const locator)
- virtual void startDocument ()
- virtual void endDocument ()
- virtual void startElement ( const XMLCh* const name, AttributeList& atts)
- virtual void endElement ( const XMLCh* const name)
- virtual void characters ( const XMLCh* const chars, const unsigned int length)
- virtual void ignorableWhitespace ( const XMLCh* const ch, const unsigned int length)
- virtual void processingInstruction ( const XMLCh* const target, const XMLCh* const data)
- virtual void resetDocument ()
- void clearTopLevelParams ()
- Reset the vector of top level parameters.
- XalanNode* getSourceNode () const
- Returns the current input node that is being processed.
Public Attributes
Static Public Methods
Protected Methods
Protected Attributes
Static Protected Methods
Detailed Description
It's the responsibility of the XSLTEngineImpl class, collaborating with the XML parser liaison, the DOM, and the XPath engine, to transform a source tree of nodes into a result tree according to instructions and templates specified by a stylesheet tree.
The process method is the primary
public entry points.
If you reuse the processor instance, you should call reset() between calls.
Member Typedef Documentation
typedef std::map<XalanDOMString, int> XSLTEngineImpl::AttributeKeysMapType |
|
typedef std::vector<bool> XSLTEngineImpl::BoolVectorType |
|
typedef std::map<const void*, clock_t> XSLTEngineImpl::DurationsTableMapType |
|
typedef std::map<XalanDOMString, int> XSLTEngineImpl::ElementKeysMapType |
|
typedef std::vector<const Locator*> XSLTEngineImpl::LocatorStack |
|
typedef std::vector<NameSpace> XSLTEngineImpl::NamespaceVectorType |
|
typedef StylesheetExecutionContext::ParamVectorType XSLTEngineImpl::ParamVectorType |
|
typedef std::vector<TraceListener*> XSLTEngineImpl::TraceListenerVectorType |
|
typedef Function::XObjectArgVectorType XSLTEngineImpl::XObjectArgVectorType |
|
Constructor & Destructor Documentation
Construct an XSL processor that can call back to a XML processor, so it can handle included files, and the like.
You must create a new instance
of the XSLTEngineImpl class each time you run a transformation.
-
Parameters:
-
XMLParserLiaison
|
liaison to an object that can help with a
specific parser implementation
|
xpathSupport
|
$$$
|
xpathEnvSupport
|
$$$
|
xobjectFactory
|
object responsible for XObject objects
|
xpathFactory
|
object responsible for XPath objects
|
virtual XSLTEngineImpl::~XSLTEngineImpl () [virtual] |
|
Member Function Documentation
Add attribute to pending attributes list, and if it is a namespace, add it to the namespaces stack.
-
Parameters:
-
aname
|
name of attribute
|
value
|
value of attribute
|
Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack.
-
Parameters:
-
attList
|
attribute list added to
|
aname
|
name of attribute
|
value
|
value of attribute
|
Add a namespace declaration to the namespace stack.
-
Parameters:
-
prefix
|
namespace prefix
|
namespaceVal
|
value of namespace
|
virtual void XSLTEngineImpl::addTraceListener (
|
TraceListener * tl) [virtual] |
|
Add a trace listener for the purposes of debugging and diagnosis.
-
Parameters:
-
tl
|
pointer to listener to add
|
Reimplemented from XSLTProcessor.
void XSLTEngineImpl::cdata (
|
const XMLCh * const ch, |
|
const unsigned int start, |
|
const unsigned int length) [virtual] |
|
Receive notification of cdata.
The Parser will call this method to report each chunk of
character data. SAX parsers may return all contiguous character
data in a single chunk, or they may split it into several
chunks; however, all of the characters in any single event
must come from the same external entity, so that the Locator
provides useful information.
The application must not attempt to read from the array
outside of the specified range.
Note that some parsers will report whitespace using the
ignorableWhitespace() method rather than this one (validating
parsers must do so).
-
Parameters:
-
ch
|
pointer to characters from the XML document
|
start
|
start position in the array
|
length
|
number of characters to read from the array
|
-
Exceptions:
-
virtual void XSLTEngineImpl::characters (
|
const XMLCh * const chars, |
|
const unsigned int length) [virtual] |
|
void XSLTEngineImpl::characters (
|
const XMLCh * const ch, |
|
const unsigned int start, |
|
const unsigned int length) [virtual] |
|
Receive notification of character data.
The Parser will call this method to report each chunk of
character data. SAX parsers may return all contiguous character
data in a single chunk, or they may split it into several
chunks; however, all of the characters in any single event
must come from the same external entity, so that the Locator
provides useful information.
The application must not attempt to read from the array
outside of the specified range.
Note that some parsers will report whitespace using the
ignorableWhitespace() method rather than this one (validating
parsers must do so).
NOTE: This method is only provided for compatibility with existing code
-
Parameters:
-
ch
|
pointer to characters from the XML document
|
start
|
startng offset in 'ch' array
|
length
|
number of characters to read from the array
|
-
Deprecated:
-
void XSLTEngineImpl::charactersRaw (
|
const XMLCh * const ch, |
|
const unsigned int start, |
|
const unsigned int length) [virtual] |
|
Receive notification of character data.
If available, when the
disable-output-escaping attribute is used, output raw text without
escaping.
-
Parameters:
-
ch
|
pointer to characters from the XML document
|
start
|
start position in the array
|
length
|
number of characters to read from the array
|
-
Exceptions:
-
void XSLTEngineImpl::clearTopLevelParams () |
|
Reset the vector of top level parameters.
void XSLTEngineImpl::cloneToResultTree (
|
XalanNode & node, |
|
bool isLiteral, |
|
bool overrideStrip, |
|
bool shouldCloneAttributes) |
|
Clone an element with or without children.
-
Parameters:
-
node
|
node to clone
|
isLiteral
|
true if a literal element
|
overrideStrip
|
false if white space stripping should be done
|
shouldCloneAttributes
|
true if attributes should be cloned
|
void XSLTEngineImpl::comment (
|
const XMLCh * const data) [virtual] |
|
Called when a Comment is to be constructed.
-
Parameters:
-
data
|
pointer to comment data
|
-
Exceptions:
-
Copy an attribute to the created output element, executing attribute templates as need be, and processing the 'xsl:use' attribute.
-
Parameters:
-
attr
|
attribute to copy
|
contextNode
|
current context node
|
stylesheetTree
|
associated stylesheet object
|
attrList
|
attribute list added to
|
namespaceContext
|
context for namespace
|
-
Exceptions:
-
Copy the attributes from the XSL element to the created output element, executing attribute templates and processing the xsl:use attribute as need be.
-
Exceptions:
-
void XSLTEngineImpl::copyNamespaceAttributes (
|
const XalanNode & src, |
|
bool srcIsStylesheetTree) |
|
Copy XMLNS: attributes in if not already in scope.
-
Parameters:
-
src
|
source node
|
srcIsStylesheetTree
|
true if source node is a stylesheet tree
|
Create a document fragment.
This function may return null.
-
Returns:
-
pointer to new document fragment
Create and initialize an xpath and return it.
-
Parameters:
-
str
|
string for XPath
|
resolver
|
resolver for namespace resolution
|
-
Returns:
-
pointer to XPath created
Create an empty result tree fragment.
Caller owns the memory.
-
Returns:
-
pointer to an object that represents the result tree fragment
Reimplemented from XSLTProcessor.
Given a stylesheet element, create a result tree fragment from its contents.
Caller owns the memory.
-
Parameters:
-
templateChild
|
template element that holds the fragment
|
sourceTree
|
source tree document context
|
sourceNode
|
current source context node
|
mode
|
mode under which the template is operating
|
-
Returns:
-
pointer to an object that represents the result tree fragment
-
Exceptions:
-
Reimplemented from XSLTProcessor.
Print a diagnostics string to the output device.
-
Parameters:
-
void XSLTEngineImpl::displayDuration (
|
const XalanDOMString & info, |
|
const void * key) const |
|
Display the duration since pushTime was called for element in milliseconds, and a descriptive message.
-
Parameters:
-
info
|
message to display
|
key
|
pointer to element involved
|
bool XSLTEngineImpl::doDiagnosticsOutput () |
|
Whether diagnostic output is to be generated.
-
Returns:
-
true for diagnostics output
virtual void XSLTEngineImpl::endDocument () [virtual] |
|
virtual void XSLTEngineImpl::endElement (
|
const XMLCh * const name) [virtual] |
|
void XSLTEngineImpl::entityReference (
|
const XMLCh * const data) [virtual] |
|
Receive notification of a entityReference.
-
Parameters:
-
data
|
pointer to characters from the XML document
|
-
Exceptions:
-
Tell the user of an error, and probably throw an exception.
-
Parameters:
-
msg
|
text of message to output
|
sourceNode
|
node in source where error occurred
|
styleNode
|
node in stylesheet where error occurred
|
-
Exceptions:
-
Reimplemented from XSLTProcessor.
Evaluate an xpath string and return the result as a numberic score.
-
Parameters:
-
str
|
string to evaluate
|
context
|
context node
|
executionContext
|
current execution context
|
-
Returns:
-
score number, higher representing better match
Evaluate an xpath string and return the result.
-
Parameters:
-
str
|
string to evaluate
|
contextNode
|
context node
|
prefixResolver
|
prefix resolver to use
|
executionContext
|
current execution context
|
-
Returns:
-
pointer to XObject result
Evaluate an xpath string and return the result.
-
Parameters:
-
str
|
string to evaluate
|
contextNode
|
context node
|
prefixResolver
|
prefix resolver to use
|
executionContext
|
current execution context
|
-
Returns:
-
pointer to XObject result
Evaluate an xpath string and return the result.
-
Parameters:
-
str
|
string to evaluate
|
executionContext
|
current execution context
|
-
Returns:
-
pointer to XObject result
Evaluates attribute values for attribute templates (Stuff in curly {} braces that hold expressions).
-
Parameters:
-
contextNode
|
current node in the source tree
|
namespaceContext
|
current namespace context for the
pattern-by-example structures when parsing
expressions
|
stringedValue
|
attribute value to be processed
|
executionContext
|
current execution context
|
-
Returns:
-
processed stringedValue with attribute templates resolved
-
Exceptions:
-
Reimplemented from XSLTProcessor.
Given a tag name, an attribute name, and an attribute value, do a very crude recursive search and locate the first match.
virtual void XSLTEngineImpl::fireGenerateEvent (
|
const GenerateEvent & ge) [virtual] |
|
Fire a generate event.
-
Parameters:
-
ge
|
generate event to fire
|
Reimplemented from XSLTProcessor.
virtual void XSLTEngineImpl::fireSelectEvent (
|
const SelectionEvent & se) [virtual] |
|
Fire a selection event.
-
Parameters:
-
se
|
selection event to fire
|
Reimplemented from XSLTProcessor.
virtual void XSLTEngineImpl::fireTraceEvent (
|
const TracerEvent & te) [virtual] |
|
Fire a trace event.
-
Parameters:
-
Reimplemented from XSLTProcessor.
Conditionally trim all leading and trailing whitespace in the specified String.
All strings of white space are replaced by a single space
character (x20), except spaces after punctuation which receive double
spaces if doublePunctuationSpaces is true. This function may be useful to
a formatter, but to get first class results, the formatter should
probably do its own white space handling based on the semantics of the
formatting object.
-
Parameters:
-
string
|
string to be trimmed
|
trimHead
|
whether to trim leading whitespace
|
trimTail
|
whether to trim trailing whitespace
|
doublePunctuationSpaces
|
true to use double spaces for punctuation
|
-
Returns:
-
trimmed string
void XSLTEngineImpl::flushPending () |
|
Flush the pending element.
int XSLTEngineImpl::getAttrTok (
|
const XalanDOMString & name) [static] |
|
Given an XSL tag name, return an integer token that corresponds to ELEMNAME_XXX constants defined in Constants.hpp.
-
Parameters:
-
name
|
a probable xsl:xxx element
|
-
Returns:
-
Constants.ELEMNAME_XXX token, -1 if in XSL or Xalan namespace,
or -2 if not in known namespace
Given an element, return an attribute value in the form of a string.
-
Parameters:
-
el
|
element from where to get the attribute
|
key
|
name of the attribute
|
-
Returns:
-
string for attribute value
Given an element, return an attribute value in the form of a string.
-
Parameters:
-
el
|
element from where to get the attribute
|
key
|
name of the attribute
|
contextNode
|
context to evaluate the attribute value template
|
-
Returns:
-
string for attribute value
Accessor method for hash table of XSLT IDs for attribute names.
-
Returns:
-
hash table of key names and IDs
Given a valid element id, return the corresponding element.
-
Parameters:
-
id
|
string representing ID
|
doc
|
document to search
|
-
Returns:
-
element for ID
Accessor method for hash table of XSLT IDs for element names.
-
Returns:
-
hash table of key names and IDs
int XSLTEngineImpl::getElementToken (
|
const XalanDOMString & name) [static] |
|
Given an XSL tag name, return an integer token that corresponds to ELEMNAME_XXX constants defined in Constants.hpp.
-
Parameters:
-
name
|
a probable xsl:xxx element
|
-
Returns:
-
Constants.ELEMNAME_XXX token, -1 if in XSL or Xalan namespace,
or -2 if not in known namespace
Get the current formatter listener.
-
Returns:
-
pointer to formatter listener
Reimplemented from XSLTProcessor.
bool XSLTEngineImpl::getHasPendingStartDocument () const |
|
const Locator * XSLTEngineImpl::getLocatorFromStack () const |
|
Get the locator from the top of the locator stack.
-
Returns:
-
A pointer to the Locator, or 0 if there is nothing on the stack.
bool XSLTEngineImpl::getMustFlushPendingStartDocument () const |
|
Normalize the linefeeds and/or carriage returns to be consistently 0x0D 0x0A.
-
Parameters:
-
tx
|
DOM text node to normalize
|
-
Returns:
-
normalized string
Retrieve list of attributes yet to be processed.
-
Returns:
-
attribute list
Retrieve name of the pending element currently being processed.
-
Returns:
-
element name
Get the problem listener property.
The XSL class can have a single
listener that can be informed of errors and warnings, and can normally
control if an exception is thrown or not (or the problem listeners can
throw their own RuntimeExceptions).
-
Returns:
-
pointer to ProblemListener interface
bool XSLTEngineImpl::getQuietConflictWarnings () const |
|
Whether to warn about pattern match conflicts.
-
Returns:
-
true to not warn about pattern match conflicts
Retrieve the result namespace corresponding to a prefix.
-
Parameters:
-
prefix
|
prefix for namespace
|
-
Returns:
-
string for namespace URI
Retrieve the result prefix corresponding to a namespace.
-
Parameters:
-
theNamespace
|
namespace for prefix
|
-
Returns:
-
string for namespace prefix
XalanNode * XSLTEngineImpl::getSourceNode () const |
|
Returns the current input node that is being processed.
Given an input source, get the source tree.
-
Parameters:
-
inputSource
|
pointer to input source
|
-
Returns:
-
source tree
Reimplemented from XSLTProcessor.
bool XSLTEngineImpl::getStripWhiteSpace () const |
|
Determine the value of the default-space attribute.
-
Returns:
-
true if the default-space attribute is "strip," false if
the attribute is "preserve"
Reset the state of the XSL processor by reading in a new XSL stylesheet from a processing instruction.
-
Parameters:
-
xslURLString
|
valid URI to an XSL stylesheet
|
fragBase
|
base of tree if URI represents document
fragment
|
xmlBaseIdent
|
base identifier for stylesheet URI
|
isRoot
|
true if stylesheet is root of tree
|
constructionContext
|
context for construction of object
|
-
Returns:
-
pointer to stylesheet
const StylesheetRoot * XSLTEngineImpl::getStylesheetRoot () const [virtual] |
|
Retrieve the root stylesheet.
-
Returns:
-
pointer to root stylesheet
Reimplemented from XSLTProcessor.
virtual unsigned long XSLTEngineImpl::getTraceListeners () const [virtual] |
|
Determine the number of trace listeners.
-
Returns:
-
number of listeners
Reimplemented from XSLTProcessor.
virtual bool XSLTEngineImpl::getTraceSelects () const [virtual] |
|
If this is set to true, simple traces of template calls are made.
-
Returns:
-
true if traces made
Reimplemented from XSLTProcessor.
virtual const XalanDOMString XSLTEngineImpl::getUniqueNSValue () const [virtual] |
|
Generate a random namespace prefix guaranteed to be unique.
-
Returns:
-
unique namespace prefix
Reimplemented from XSLTProcessor.
virtual XMLParserLiaison& XSLTEngineImpl::getXMLParserLiaison () const [virtual] |
|
Get the XML Parser Liaison that this processor uses.
-
Returns:
-
XML parser liaison object
Reimplemented from XSLTProcessor.
Retrieve the XPath environment support object.
-
Returns:
-
XPath environment support object
Get the factory for making xpaths.
-
Returns:
-
XPath factory object
Retrieve the XPath support object.
-
Returns:
-
XPath support object
double XSLTEngineImpl::getXSLTVerSupported () [static] |
|
Get the latest XSLT version currently supported.
-
Returns:
-
XSLT version number
int XSLTEngineImpl::getXSLToken (
|
const XalanNode & node) const |
|
Given an XSL tag name, return an integer token that corresponds to ELEMNAME_XXX constants defined in Constants.java.
-
Parameters:
-
node
|
a probable xsl:xxx element.
|
-
Returns:
-
Constants.ELEMNAME_XXX token, -1 if in XSL or Xalan namespace,
or -2 if not in known namespace
const XalanDOMString & XSLTEngineImpl::getXalanXSLNameSpaceURL () [static] |
|
Special Xalan namespace for built-in extensions.
-
Returns:
-
Xalan namespace for extensions
virtual void XSLTEngineImpl::ignorableWhitespace (
|
const XMLCh * const ch, |
|
const unsigned int length) [virtual] |
|
void XSLTEngineImpl::initialize () [static] |
|
Perform initialization of statics -- must be called before any processing occurs.
See class XSLTInit.
void XSLTEngineImpl::initializeAttributeKeysTable (
|
AttributeKeysMapType & theAttributeKeys) [static] |
|
void XSLTEngineImpl::initializeElementKeysTable (
|
ElementKeysMapType & theElementKeys) [static] |
|
void XSLTEngineImpl::initializeXSLT4JElementKeys (
|
ElementKeysMapType & theElementKeys) [static] |
|
void XSLTEngineImpl::installFunctions () [static] |
|
bool XSLTEngineImpl::isCDataResultElem (
|
const XalanDOMString & elementName) const |
|
Tell if a given element name should output it's text as cdata.
-
Parameters:
-
elementName
|
name of element
|
-
Returns:
-
true if it should output as cdata
bool XSLTEngineImpl::isXSLTagOfType (
|
const XalanNode & node, |
|
int tagType) const |
|
Find the type of an element using this method.
-
Parameters:
-
node
|
a probable xsl:xxx element
|
tagType
|
Constants.ELEMNAME_XXX token
|
-
Returns:
-
true if node is of tagType
Give the user a message.
-
Parameters:
-
msg
|
text of message to output
|
sourceNode
|
node in source where message occurred
|
styleNode
|
node in stylesheet where message occurred
|
Reimplemented from XSLTProcessor.
Given a result tree fragment, walk the tree and output it to the result stream.
-
Parameters:
-
theTree
|
result tree fragment
|
Output an object to the result tree by doing the right conversions.
This is public for access by extensions.
-
Parameters:
-
executionContext
|
current execution context
|
obj
|
the XObject to output
|
Reimplemented from XSLTProcessor.
Read in the XML file, either producing a Document or calling SAX events, and register the document in a table.
If the document has already been
read in, it will not be reparsed.
-
Parameters:
-
urlString
|
location of the XML
|
docHandler
|
pointer to SAX event handler
|
docToRegister
|
if using a SAX event handler, the object to register in the source docs table.
|
-
Returns:
-
document object, which represents the parsed XML
-
Exceptions:
-
clock_t XSLTEngineImpl::popDuration (
|
const void * key) const |
|
Returns the duration since pushTime was called for element in milliseconds.
-
Parameters:
-
key
|
pointer to element involved
|
void XSLTEngineImpl::popLocatorStack () |
|
Pop the locator from the top of the locator stack.
Transform the source tree to the output in the given result tree target.
This function does not create a stylesheet tree, it assumes the
provided StylesheetExecutionContext has the stylesheet tree to use. This
is set by calling StylesheetExecutionContext::setStylesheetRoot().
-
Parameters:
-
inputSource
|
input source
|
outputTarget
|
output source tree
|
executionContext
|
current execution context
|
-
Exceptions:
-
Reimplemented from XSLTProcessor.
Transform the source tree to the output in the given result tree target.
The processor will process the input source, the stylesheet source,
and transform to the output target.
-
Parameters:
-
inputSource
|
input source
|
stylesheetSource
|
stylesheet source
|
outputTarget
|
output source tree
|
constructionContext
|
context for construction of objects
|
executionContext
|
current execution context
|
-
Exceptions:
-
Reimplemented from XSLTProcessor.
Given a URI to an XSL stylesheet, compile the stylesheet into an internal representation.
-
Parameters:
-
xmldocURLString
|
URI to the input XML document
|
constructionContext
|
context for construction of objects
|
-
Returns:
-
pointer to compiled stylesheet object
-
Exceptions:
-
Reimplemented from XSLTProcessor.
Given a stylesheet input source, compile the stylesheet into an internal representation.
-
Parameters:
-
stylesheetSource
|
input source for the stylesheet
|
constructionContext
|
context for construction of objects
|
-
Returns:
-
pointer to the compiled stylesheet object
-
Exceptions:
-
Reimplemented from XSLTProcessor.
virtual void XSLTEngineImpl::processingInstruction (
|
const XMLCh * const target, |
|
const XMLCh * const data) [virtual] |
|
void XSLTEngineImpl::pushLocatorOnStack (
|
const Locator * locator) |
|
Push a locator on to the locator stack.
-
Parameters:
-
A
|
pointer to the Locator to push.
|
void XSLTEngineImpl::pushTime (
|
const void * key) const |
|
Mark the time, so that displayDuration can later display the elapsed clock ticks.
-
Parameters:
-
theKey
|
pointer to element to push
|
bool XSLTEngineImpl::qnameEqualsResultElemName (
|
const QName & qname, |
|
const XalanDOMString & elementName) const |
|
Tell if a qualified name equals the current result tree name.
-
Parameters:
-
qname
|
QName to compare to
|
elementName
|
current result tree element
|
-
Returns:
-
true if names are the same
virtual void XSLTEngineImpl::removeTraceListener (
|
TraceListener * tl) [virtual] |
|
Remove a trace listener.
-
Parameters:
-
tl
|
Trace listener to be removed.
|
Reimplemented from XSLTProcessor.
void XSLTEngineImpl::reset () [virtual] |
|
Reset the state.
This needs to be called after a process() call
is invoked, if the processor is to be used again.
Reimplemented from XSLTProcessor.
virtual void XSLTEngineImpl::resetCurrentState (
|
XalanNode * sourceTree, |
|
XalanNode * xmlNode) [virtual] |
|
Reset the state of execution to node 'xmlNode' in source tree 'sourceTree.'.
-
Parameters:
-
sourceTree
|
source tree for execution
|
xmlNode
|
node to execute
|
Reimplemented from XSLTProcessor.
virtual void XSLTEngineImpl::resetDocument () [virtual] |
|
Resolve the params that were pushed by the caller.
Reimplemented from XSLTProcessor.
void XSLTEngineImpl::returnXPath (
|
const XPath * xpath) |
|
virtual void XSLTEngineImpl::setDiagnosticsOutput (
|
PrintWriter * pw) [virtual] |
|
If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.
If
the value is null, then diagnostics will be turned
off.
-
Parameters:
-
pw
|
pointer to print writer
|
Reimplemented from XSLTProcessor.
virtual void XSLTEngineImpl::setDocumentLocator (
|
const Locator * const locator) [virtual] |
|
Set the execution context.
-
Parameters:
-
theExecutionContext
|
pointer to new execution context.
|
Reimplemented from XSLTProcessor.
virtual void XSLTEngineImpl::setFormatterListener (
|
FormatterListener * flistener) [virtual] |
|
Set the current formatter listener.
-
Parameters:
-
flistener
|
pointer to new formatter listener
|
Reimplemented from XSLTProcessor.
void XSLTEngineImpl::setHasPendingStartDocument (
|
bool b) |
|
void XSLTEngineImpl::setMustFlushPendingStartDocument (
|
bool b) |
|
void XSLTEngineImpl::setOutputCarriageReturns (
|
bool b) |
|
Control if carriage returns are put in the result tree.
Default is to
output carriage returns.
-
Parameters:
-
b
|
true to output carriage returns
|
void XSLTEngineImpl::setOutputLinefeeds (
|
bool b) |
|
Control if linefeeds are put in the result tree.
Default is to output
linefeeds.
-
Parameters:
-
b
|
true to output linefeeds
|
void XSLTEngineImpl::setPendingAttributes (
|
const AttributeList & pendingAttributes) |
|
Sets a list of attributes yet to be processed.
-
Parameters:
-
pendingAttributes
|
attribute list
|
void XSLTEngineImpl::setPendingElementName (
|
const XalanDOMString & elementName) |
|
Changes the currently pending element name.
-
Parameters:
-
elementName
|
new name of element
|
Set the problem listener property.
The XSL class can have a single
listener that can be informed of errors and warnings, and can normally
control if an exception is thrown or not (or the problem listeners can
throw their own RuntimeExceptions).
-
Parameters:
-
virtual void XSLTEngineImpl::setQuietConflictWarnings (
|
bool b) [virtual] |
|
If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be printed to the diagnostics stream.
True by default.
-
Parameters:
-
b
|
true if conflict warnings should be suppressed.
|
Reimplemented from XSLTProcessor.
void XSLTEngineImpl::setStripWhiteSpace (
|
bool fStrip) |
|
Change the value of the default-space attribute.
-
Parameters:
-
b
|
sets the default of the default-space attribute to "strip" if
true, or "preserve" if false.
|
Push a top-level stylesheet parameter.
This value can be evaluated via
xsl:param-variable.
-
Parameters:
-
key
|
name of the parameter
|
value
|
XObject value for parameter
|
Reimplemented from XSLTProcessor.
Push a top-level stylesheet parameter.
This value can be evaluated via
xsl:param-variable.
-
Parameters:
-
key
|
name of the param
|
expression
|
expression that will be evaluated
|
Reimplemented from XSLTProcessor.
void XSLTEngineImpl::setStylesheetRoot (
|
const StylesheetRoot * theStylesheet) [virtual] |
|
Set the root stylesheet.
-
Parameters:
-
theStylesheet
|
pointer to new root stylesheet
|
Reimplemented from XSLTProcessor.
virtual void XSLTEngineImpl::setTraceSelects (
|
bool b) [virtual] |
|
Tells, through the combination of the default-space attribute on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the xml:space attribute, whether or not extra whitespace should be stripped from the node.
Literal elements from template elements should not be
tested with this function.
-
Parameters:
-
executionContext
|
current execution context
|
node
|
text node from the source tree
|
-
Returns:
-
true if the text node should be stripped of extra whitespace
$$$ ToDo: This has no business being here in the engine...
Reimplemented from XSLTProcessor.
virtual void XSLTEngineImpl::startDocument () [virtual] |
|
virtual void XSLTEngineImpl::startElement (
|
const XMLCh * const name, |
|
AttributeList & atts) [virtual] |
|
void XSLTEngineImpl::startElement (
|
const XMLCh * const name) [virtual] |
|
Receive notification of the beginning of an element with an empty attribute list.
-
Parameters:
-
-
Exceptions:
-
void XSLTEngineImpl::terminate () [static] |
|
Perform termination of statics.
See class XSLTInit.
Compose a diagnostic trace of the current selection.
-
Parameters:
-
theTemplate
|
current context node
|
nl
|
list of selected nodes
|
Reimplemented from XSLTProcessor.
void XSLTEngineImpl::uninstallFunctions () [static] |
|
Tell the user of an warning, and probably throw an exception.
-
Parameters:
-
msg
|
text of message to output
|
sourceNode
|
node in source where error occurred
|
styleNode
|
node in stylesheet where error occurred
|
-
Exceptions:
-
Reimplemented from XSLTProcessor.
Member Data Documentation
Stack of Booleans to keep track of if we should be outputting cdata instead of escaped text.
## Optimization: use array stack instead of object stack.
This holds the current context node list.
This should arguably be
passed by parameter.
XalanNode * XSLTEngineImpl::m_currentNode [protected] |
|
NameSpace XSLTEngineImpl::m_emptyNamespace [protected] |
|
This is pushed on the m_resultNameSpaces stack until a xmlns attribute is found.
It's special because it has
and empty prefix and uri field.
Current execution context...
The listener for formatting events.
This should be
supplied by the Formatter object.
bool XSLTEngineImpl::m_hasPendingStartDocument [protected] |
|
bool XSLTEngineImpl::m_mustFlushStartDocument [protected] |
|
bool XSLTEngineImpl::m_outputCarriageReturns [protected] |
|
If true, output carriage returns.
bool XSLTEngineImpl::m_outputLinefeeds [protected] |
|
If true, output linefeeds.
The liason to the XML parser, so the XSL processor can handle included files, and the like, and do the initial parse of the XSL document.
The pending attributes.
We have to delay the call to
m_flistener.startElement(name, atts) because of the
xsl:attribute and xsl:copy calls. In other words,
the attributes have to be fully collected before you
can call startElement.
The pending element.
We have to delay the call to
m_flistener.startElement(name, atts) because of the
xsl:attribute and xsl:copy calls. In other words,
the attributes have to be fully collected before you
can call startElement.
The namespace that the result tree conforms to.
A null value
indicates that result-ns is not used and there is no checking.
A empty string indicates that the result tree conforms to the
default namespace.
The URL that belongs to the result namespace.
A stack to keep track of the result tree namespaces.
mutable XalanDocument * XSLTEngineImpl::m_resultTreeFactory [protected] |
|
The factory that will be used to create result tree fragments.
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.
Xalan-C++ XSL Transformer Version 1.0
Copyright © 2000 The Apache Software Foundation. All Rights Reserved.
|
|