18#if !defined(XALAN_XSLTENGINEIMPL_HEADER_GUARD)
19#define XALAN_XSLTENGINEIMPL_HEADER_GUARD
43#if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
81namespace XERCES_CPP_NAMESPACE
84 class DocumentHandler;
96using xercesc::InputSource;
97using xercesc::DocumentHandler;
105class StylesheetConstructionContext;
108class XalanSourceTreeDocument;
110class XMLParserLiaison;
112class XPathEnvSupport;
115class XSLTResultTarget;
142 if (theLHS == 0 && theRHS != 0)
146 else if (theRHS == 0)
152 return theLHS->
compare(*theRHS) < 0 ? true :
false;
173 assert(theString != 0);
175 return *theString == m_string;
207 MemoryManager& theManager,
220 return m_xpathConstructionContext.getMemoryManager();
226 return m_xpathConstructionContext.getMemoryManager();
249 const Locator* locator,
345 const XPath* xpath)
const;
389 DocumentHandler* docHandler,
391 ErrorHandler* theErrorHandler = 0);
406 const InputSource& inputSource,
407 DocumentHandler* docHandler,
409 ErrorHandler* theErrorHandler = 0);
450 namespaceVal.
c_str(),
464 const XalanDOMChar* namespaceVal,
467 m_resultNamespacesStack.addDeclaration(
488 bool fromCopy =
false,
489 const Locator* locator = 0)
513 const XalanDOMChar* value,
514 bool fromCopy =
false,
515 const Locator* locator = 0)
541 const XalanDOMChar* value,
543 bool fromCopy =
false,
544 const Locator* locator = 0);
558 const XalanDOMChar* value,
559 bool fromCopy =
false,
560 const Locator* locator = 0)
562 assert(m_outputContextStack.empty() ==
false);
585 bool fromCopy =
false,
586 const Locator* locator = 0)
588 assert(m_outputContextStack.empty() ==
false);
606 const Locator* locator);
619 const XalanDOMChar* name,
627 const XalanDOMChar* ch,
632 const XalanDOMChar* ch,
637 const XalanDOMChar* target,
638 const XalanDOMChar* data);
652 const XalanDOMChar* ch,
692 const XalanDOMChar* ch,
738 const XalanDOMChar* ch,
752 bool cloneTextNodesOnly,
753 const Locator* locator);
770 bool shouldCloneAttributes,
771 bool cloneTextNodesOnly,
772 const Locator* locator);
784 bool outputTextNodesOnly,
785 const Locator* locator);
798 bool outputTextNodesOnly,
799 const Locator* locator)
818 bool outputTextNodesOnly,
819 const Locator* locator);
854 return s_XSLNameSpaceURL;
865 return s_XalanNamespaceURL;
876 return m_quietConflictWarnings;
1045 return m_xpathEnvSupport;
1059 m_problemListener = l;
1073 return m_problemListener;
1084 m_outputContextStack.pushContext(theListener);
1093 m_outputContextStack.popContext();
1167 const XalanDOMChar* theName,
1168 const XalanDOMChar* theNewType,
1169 const XalanDOMChar* theNewValue)
1218 return m_stylesheetLocatorStack.empty() ==
true ? 0 : m_stylesheetLocatorStack.back();
1229 m_stylesheetLocatorStack.push_back(locator);
1238 if (m_stylesheetLocatorStack.empty() ==
false)
1240 m_stylesheetLocatorStack.pop_back();
1254 return m_outputContextStack.getPendingAttributes();
1265 return m_outputContextStack.getPendingAttributes();
1287 return m_outputContextStack.getPendingElementName();
1298 return m_outputContextStack.getPendingElementName();
1309 m_outputContextStack.getPendingElementName() = elementName;
1320 assert(elementName != 0);
1322 m_outputContextStack.getPendingElementName() = elementName;
1332 return m_outputContextStack.getHasPendingStartDocument();
1342 m_outputContextStack.getHasPendingStartDocument() = b;
1352 return m_outputContextStack.getMustFlushPendingStartDocument();
1362 m_outputContextStack.getMustFlushPendingStartDocument() = b;
1368 return m_outputContextStack.getFormatterListener();
1374 m_outputContextStack.getFormatterListener() = flistener;
1424 warnCopyTextNodesOnly(
1426 const Locator* locator);
1437 bool overrideStrip);
1444 pendingAttributesHasDefaultNS()
const;
1452 bool fOnlyIfPrefixNotPresent);
1458 bool fOnlyIfPrefixNotPresent =
false);
1499 bool m_traceSelects;
1505 bool m_quietConflictWarnings;
1529 const Locator& locator,
1544 XMLUInt32 m_uniqueNSValue;
1556 m_topLevelParams.clear();
1562 generateCDATASection()
const
1564 if (m_hasCDATASectionElements ==
false)
1570 assert(m_cdataStack.
empty() ==
false);
1572 return m_cdataStack.
back();
1579 setMustFlushPendingStartDocument(
true);
1592 isCDataResultElem(
const XalanDOMString& elementName);
1595 fireCharacterGenerateEvent(
1596 const XalanNode& theNode,
1600 fireCharacterGenerateEvent(
1601 const XObjectPtr& theXObject,
1605 fireCharacterGenerateEvent(
1606 const XalanDOMString& theString,
1610 fireCharacterGenerateEvent(
1611 const XalanDOMChar* ch,
1617 checkDefaultNamespace(
1618 const XalanDOMString& theElementName,
1619 const XalanDOMString& theElementNamespaceURI);
1623 const XalanDOMString& theMessage,
1624 const Locator* theLocator,
1625 const XalanNode* theSourceNode);
1629 const XalanDOMString& theMessage,
1630 const Locator* theLocator,
1631 const XalanNode* theSourceNode);
1635 const XalanDOMString& theMessage,
1636 const Locator* theLocator,
1637 const XalanNode* theSourceNode);
1640 XMLParserLiaison& m_parserLiaison;
1642 XPathEnvSupport& m_xpathEnvSupport;
1644 DOMSupport& m_domSupport;
1649 StylesheetExecutionContext* m_executionContext;
1654 OutputContextStack m_outputContextStack;
1659 XalanNamespacesStack m_resultNamespacesStack;
1664 AttributeListImpl m_dummyAttributesList;
1666 XalanDOMString m_scratchString;
1668 XalanDOMStringPointerVectorType m_attributeNamesVisited;
1670 bool m_hasCDATASectionElements;
1672 XPathConstructionContextDefault m_xpathConstructionContext;
1674 ParamMapType m_stylesheetParams;
1677 installFunctions(MemoryManager& theManager);
1680 uninstallFunctions();
1683 static const XalanDOMString s_emptyString;
1685 static const XalanDOMString& s_stylesheetNodeName;
1686 static const XalanDOMString& s_typeString;
1687 static const XalanDOMString& s_hrefString;
1688 static const XalanDOMString& s_piTokenizerString;
1689 static const XalanDOMString& s_typeValueString1;
1690 static const XalanDOMString& s_typeValueString2;
1691 static const XalanDOMString& s_typeValueString3;
1692 static const XalanDOMString& s_typeValueString4;
1695 XSLTEngineImpl(
const XSLTEngineImpl&);
1698 operator=(
const XSLTEngineImpl&);
#define XALAN_XSLT_EXPORT
XPathExecutionContext::XObjectArgVectorType XObjectArgVectorType
This is the class for events generated by the XSL processor after it generates a new node in the resu...
Local implementation of NodeRefList.
The implementation of the default error handling for Xalan.
This is the abstract class that the XSL processor uses when it has a problem of some kind,...
XalanVector< TopLevelArg > ParamVectorType
This acts as the stylesheet root of the stylesheet tree, and holds values that are shared by all styl...
This class represents the base stylesheet or an "import" stylesheet.
This is the parent class of events generated for tracing the progress of the XSL processor.
This class handles the creation of XObjects and manages their lifetime.
Class to hold XObjectPtr return types.
Class to hold XPath return types.
virtual const XalanDocumentFragment & rtree() const
Cast result object to a result tree fragment.
BoolVectorType m_cdataStack
Stack of Booleans to keep track of if we should be outputting cdata instead of escaped text.
void pushLocatorOnStack(const Locator *locator)
Push a locator on to the locator stack.
void entityReference(const XalanDOMChar *data)
Receive notification of a entityReference.
void setHasPendingStartDocument(bool b)
void setMustFlushPendingStartDocumentImpl(bool b)
virtual ~XSLTEngineImpl()
void clearTopLevelParams()
Reset the vector of top level parameters.
void addResultAttribute(const XalanDOMString &aname, const XalanDOMChar *value, bool fromCopy=false, const Locator *locator=0)
Add attribute to pending attributes list, and if it is a namespace, add it to the namespaces stack.
ProblemListener * getProblemListener() const
Get the problem listener property.
virtual size_type getTraceListeners() const
Determine the number of trace listeners.
void setPendingAttributesImpl(const AttributeListType &pendingAttributes)
Set the list of attributes yet to be processed.
void characters(const XObjectPtr &xobject)
Send character data from an XObject to the result tree.
void addResultNamespaceDecl(const XalanDOMString &prefix, const XalanDOMChar *namespaceVal, size_type len)
Add a namespace declaration to the namespace stack.
virtual void reset()
Reset the state.
virtual void setTraceSelects(bool b)
void addResultAttribute(const XalanDOMString &aname, const XalanDOMString &value, bool fromCopy=false, const Locator *locator=0)
Add attribute to pending attributes list, and if it is a namespace, add it to the namespaces stack.
StylesheetExecutionContext::ParamVectorType ParamVectorType
FormatterListener * getFormatterListenerImpl() const
void startElement(const XalanDOMChar *name)
Receive notification of the beginning of an element with an empty attribute list.
XalanVector< const Locator * > LocatorStack
void characters(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of character data.
const XalanDOMString * getResultPrefixForNamespace(const XalanDOMString &theNamespace) const
Retrieve the result prefix corresponding to a namespace.
void setProblemListener(ProblemListener *l)
Set the problem listener property.
void comment(const XalanDOMChar *data)
Called when a Comment is to be constructed.
virtual void setStylesheetParam(const XalanDOMString &key, const XalanDOMString &expression)
Set a top-level parameter, which the stylesheet can access with a top-level xsl:param.
static const XalanDOMString & getXalanXSLNameSpaceURL()
Special Xalan namespace for built-in extensions.
XPathExecutionContext::GetCachedString ECGetCachedString
virtual void fireGenerateEvent(const GenerateEvent &ge)
Fire a generate event.
void setPendingElementName(const XalanDOMString &elementName)
Changes the currently pending element name.
virtual FormatterListener * getFormatterListener() const
Get the current formatter listener.
void charactersRaw(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of character data.
XalanDocument * parseXML(const InputSource &inputSource, DocumentHandler *docHandler, XalanDocument *docToRegister, ErrorHandler *theErrorHandler=0)
Read in the XML file, either producing a Document or calling SAX events, and register the document in...
virtual StylesheetRoot * processStylesheet(const XSLTInputSource &stylesheetSource, StylesheetConstructionContext &constructionContext)
Given a stylesheet input source, compile the stylesheet into an internal representation.
XalanMap< XalanDOMString, XalanParamHolder > ParamMapType
virtual void setDiagnosticsOutput(PrintWriter *pw)
If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.
void traceSelect(StylesheetExecutionContext &executionContext, const ElemTemplateElement &theTemplate, const NodeRefListBase &nl, const XPath *xpath) const
Compose a diagnostic trace of the current selection.
void setPendingElementName(const XalanDOMChar *elementName)
virtual void clearStylesheetParams()
Clear any stylesheet params.
void setPendingAttributes(const AttributeListType &pendingAttributes)
Set the list of attributes yet to be processed.
void flushPending()
Flush the pending element.
virtual void setStylesheetRoot(const StylesheetRoot *theStylesheet)
Set the root stylesheet.
virtual void process(const XSLTInputSource &inputSource, const XSLTInputSource &stylesheetSource, XSLTResultTarget &outputTarget, StylesheetConstructionContext &constructionContext, StylesheetExecutionContext &executionContext)
Transform the source tree to the output in the given result tree target.
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...
virtual void setExecutionContext(StylesheetExecutionContext *theExecutionContext)
Set the execution context.
void pushOutputContext(FormatterListener *theListener)
void outputToResultTree(const XObject &value, bool outputTextNodesOnly, const Locator *locator)
Output an object to the result tree by doing the right conversions.
virtual XMLParserLiaison & getXMLParserLiaison() const
Get the XML Parser Liaison that this processor uses.
virtual bool getTraceSelects() const
If this is set to true, simple traces of template calls are made.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const Locator *locator, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
XObjectFactory & m_xobjectFactory
bool getMustFlushPendingStartDocument() const
bool isElementPending() const
XalanVector< TraceListener * > TraceListenerVectorType
virtual void process(const XSLTInputSource &inputSource, XSLTResultTarget &outputTarget, StylesheetExecutionContext &executionContext)
Transform the source tree to the output in the given result tree target.
void copyAttributeToTarget(const XalanDOMString &attrName, const XalanDOMString &attrValue, AttributeListImpl &attrList)
Copy an attribute to an AttributeListImpl.
virtual void fireTraceEvent(const TracerEvent &te)
Fire a trace event.
XalanDOMString m_resultNameSpacePrefix
The namespace that the result tree conforms to.
virtual void setQuietConflictWarnings(bool b)
If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be print...
bool getHasPendingStartDocumentImpl() const
MemoryManager & getMemoryManager()
void replacePendingAttribute(const XalanDOMChar *theName, const XalanDOMChar *theNewType, const XalanDOMChar *theNewValue)
Replace the contents of a pending attribute.
void characters(const XalanNode &node)
Send character data from the node to the result tree.
const XObjectPtr evalXPathStr(const XalanDOMString &str, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
const XalanDOMString * getResultNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve the result namespace corresponding to a prefix.
XSLTEngineImpl(MemoryManager &theManager, XMLParserLiaison &parserLiaison, 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,...
XalanDOMString m_resultNameSpaceURL
The URL that belongs to the result namespace.
virtual const StylesheetRoot * getStylesheetRoot() const
Retrieve the root stylesheet.
const XalanDOMString & getPendingElementNameImpl() const
Retrieve name of the pending element currently being processed.
void processingInstruction(const XalanDOMChar *target, const XalanDOMChar *data)
void outputResultTreeFragment(const XObject &theTree, bool outputTextNodesOnly, const Locator *locator)
Given a result tree fragment, walk the tree and output it to the result stream.
static const XalanDOMString & getXSLNameSpaceURL()
Retrieve the URI for the current XSL namespace, for example, "http://www.w3.org/1999/XSL/Transform".
bool getQuietConflictWarnings() const
Whether to warn about pattern match conflicts.
XPathConstructionContext::GetCachedString CCGetCachedString
XPathFactory & getXPathFactory()
Get the factory for making xpaths.
XPathFactory & m_xpathFactory
bool getHasPendingStartDocument() const
XalanVector< bool > BoolVectorType
virtual XalanNode * getSourceTreeFromInput(const XSLTInputSource &inputSource)
Given an input source, get the source tree.
AttributeListImpl & getPendingAttributesImpl()
Get the list of attributes yet to be processed.
bool getMustFlushPendingStartDocumentImpl() const
void setPendingElementNameImpl(const XalanDOMChar *elementName)
Changes the currently pending element name.
void cloneToResultTree(const XalanNode &node, XalanNode::NodeType nodeType, bool overrideStrip, bool shouldCloneAttributes, bool cloneTextNodesOnly, const Locator *locator)
Clone a node to the result tree.
virtual void setFormatterListener(FormatterListener *flistener)
Set the current formatter listener.
void addResultAttribute(AttributeListImpl &attList, const XalanDOMString &aname, const XalanDOMChar *value, size_type theLength, bool fromCopy=false, const Locator *locator=0)
Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack.
XPathEnvSupport & getXPathEnvSupport()
Retrieve the XPath environment support object.
void outputResultTreeFragment(const XalanDocumentFragment &theTree, bool outputTextNodesOnly, const Locator *locator)
Given a result tree fragment, walk the tree and output it to the result stream.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
void setPendingElementNameImpl(const XalanDOMString &elementName)
Changes the currently pending element name.
void copyAttributesToAttList(const XalanNode &node, AttributeListImpl &attList)
Copy the attributes from the XSL element to the created output element.
const AttributeListType & getPendingAttributes() const
Get the list of attributes yet to be processed.
void endElement(const XalanDOMChar *name)
virtual StylesheetRoot * processStylesheet(const XalanDOMString &xsldocURLString, StylesheetConstructionContext &constructionContext)
Given a URI to an XSL stylesheet, compile the stylesheet into an internal representation.
void addResultNamespaceDecl(const XalanDOMString &prefix, const XalanDOMString &namespaceVal)
Add a namespace declaration to the namespace stack.
void setMustFlushPendingStartDocument(bool b)
virtual void fireSelectEvent(const SelectionEvent &se)
Fire a selection event.
void returnXPath(const XPath *xpath)
Return the xpath created by createXPath() or createMatchPattern().
void cloneToResultTree(const XalanNode &node, bool cloneTextNodesOnly, const Locator *locator)
Clone a node to the result tree.
void ignorableWhitespace(const XalanDOMChar *ch, size_type length)
XalanDocument * parseXML(const XalanDOMString &urlString, DocumentHandler *docHandler, XalanDocument *docToRegister, ErrorHandler *theErrorHandler=0)
Read in the XML file, either producing a Document or calling SAX events, and register the document in...
virtual const XalanDOMString & getURI() const
Retrieve the base URI for the resolver.
const XObjectPtr evalXPathStr(const XalanDOMString &str, XalanNode *contextNode, const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
void addResultAttribute(AttributeListImpl &attList, const XalanDOMString &aname, const XalanDOMChar *value, bool fromCopy=false, const Locator *locator=0)
Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack.
virtual void addTraceListener(TraceListener *tl)
Add a trace listener for the purposes of debugging and diagnosis.
XalanVector< const XalanDOMString * > XalanDOMStringPointerVectorType
virtual void removeTraceListener(TraceListener *tl)
Remove a trace listener.
MemoryManager & getMemoryManager() const
const Locator * getLocatorFromStack() const
Get the locator from the top of the locator stack.
void reportDuplicateNamespaceNodeError(const XalanDOMString &theName, const Locator *locator)
Report an error copying a duplicate namespace node.
const XPath * createMatchPattern(const XalanDOMString &str, const PrefixResolver &resolver)
Create and initialize an xpath and return it.
void setFormatterListenerImpl(FormatterListener *flistener)
void addResultAttribute(AttributeListImpl &attList, const XalanDOMString &aname, const XalanDOMString &value, bool fromCopy=false, const Locator *locator=0)
Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack.
double evalMatchPatternStr(const XalanDOMString &str, XalanNode *context, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result as a numberic score.
const AttributeListImpl & getPendingAttributesImpl() const
Get the list of attributes yet to be processed.
void cdata(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of cdata.
XPathProcessor & getXPathProcessor()
Get the XPath processor object.
Function::XObjectArgVectorType XObjectArgVectorType
const XPathProcessorPtrType m_xpathProcessor
virtual void getUniqueNamespaceValue(XalanDOMString &theValue)
Generate a random namespace prefix guaranteed to be unique.
void popLocatorStack()
Pop the locator from the top of the locator stack.
static void initialize(MemoryManager &theManager)
Perform initialization of statics – must be called before any processing occurs.
bool isPendingResultPrefix(const XalanDOMString &thePrefix) const
Determine whether or not a prefix is in use on the pending element or the pending attributes.
void characters(const XalanDOMChar *ch, size_type length)
void copyNamespaceAttributes(const XalanNode &src)
Copy XMLNS: attributes in if not already in scope.
void charactersRaw(const XalanNode &node)
Send raw character data from the node to the result tree.
const XObjectPtr evalXPathStr(const XalanDOMString &str, XalanNode *contextNode, const XalanElement &prefixResolver, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
const XalanDOMString & getPendingElementName() const
Retrieve name of the pending element currently being processed.
void startElement(const XalanDOMChar *name, AttributeListType &atts)
XalanDOMString & getPendingElementNameImpl()
Retrieve name of the pending element currently being processed.
static void terminate()
Perform termination of statics.
void setDocumentLocator(const Locator *locator)
XalanMemMgrAutoPtr< XPathProcessor > XPathProcessorPtrType
void setHasPendingStartDocumentImpl(bool b)
void charactersRaw(const XObjectPtr &xobject)
Send raw character data from an XObject to the result tree.
virtual void setStylesheetParam(const XalanDOMString &key, XObjectPtr value)
Set a top-level parameter, which the stylesheet can access with a top-level xsl:param.
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve a namespace corresponding to a prefix.
virtual void resolveTopLevelParams(StylesheetExecutionContext &executionContext)
Resolve the params that were pushed by the caller.
const XalanDOMChar * c_str() const
int compare(const XalanDOMString &theString) const
Xalan implementation of a hashtable.
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
xercesc::InputSource InputSourceType
xercesc::AttributeList AttributeListType
xercesc::DocumentHandler DocumentHandlerType
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
FindStringPointerFunctor(const XalanDOMString &theString)
bool operator()(const XalanDOMString *theString) const
bool operator()(const XalanDOMString *theLHS, const XalanDOMString *theRHS) const