18 #if !defined(XALAN_XSLTENGINEIMPL_HEADER_GUARD)
19 #define XALAN_XSLTENGINEIMPL_HEADER_GUARD
43 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
81 namespace XERCES_CPP_NAMESPACE
84 class DocumentHandler;
96 using xercesc::InputSource;
97 using xercesc::DocumentHandler;
105 class StylesheetConstructionContext;
106 class StylesheetRoot;
108 class XalanSourceTreeDocument;
110 class XMLParserLiaison;
112 class XPathEnvSupport;
114 class XPathProcessor;
115 class 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);
448 addResultNamespaceDecl(
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);
565 getPendingAttributesImpl(),
585 bool fromCopy =
false,
586 const Locator* locator = 0)
588 assert(m_outputContextStack.empty() ==
false);
591 getPendingAttributesImpl(),
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)
801 outputResultTreeFragment(
818 bool outputTextNodesOnly,
819 const Locator* locator);
854 return s_XSLNameSpaceURL;
865 return s_XalanNamespaceURL;
876 return m_quietConflictWarnings;
1016 return m_xpathFactory;
1027 return *m_xpathProcessor.get();
1045 return m_xpathEnvSupport;
1059 m_problemListener = l;
1073 return m_problemListener;
1084 m_outputContextStack.pushContext(theListener);
1093 m_outputContextStack.popContext();
1103 return getHasPendingStartDocumentImpl();
1113 setHasPendingStartDocumentImpl(b);
1123 return getMustFlushPendingStartDocumentImpl();
1133 setMustFlushPendingStartDocumentImpl(b);
1144 return getPendingAttributesImpl();
1155 getPendingAttributesImpl() = pendingAttributes;
1167 const XalanDOMChar* theName,
1168 const XalanDOMChar* theNewType,
1169 const XalanDOMChar* theNewValue)
1173 getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue);
1179 return !getPendingElementNameImpl().empty();
1190 return getPendingElementNameImpl();
1201 setPendingElementNameImpl(elementName);
1207 setPendingElementNameImpl(elementName);
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();
1276 getPendingAttributesImpl() = pendingAttributes;
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
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
This is the class for events generated by the XSL processor after it generates a new node in the resu...
Local implementation of NodeRefList.
This class defines an interface for classes that resolve namespace prefixes to their URIs.
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,...
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.
It's the responsibility of the XSLTEngineImpl class, collaborating with the XML parser liaison,...
const Locator * getLocatorFromStack() const
Get the locator from the top of the locator stack.
BoolVectorType m_cdataStack
Stack of Booleans to keep track of if we should be outputting cdata instead of escaped text.
virtual XalanNode * getSourceTreeFromInput(const XSLTInputSource &inputSource)
Given an input source, get the source tree.
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)
const XPath * createMatchPattern(const XalanDOMString &str, const PrefixResolver &resolver)
Create and initialize an xpath and return it.
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.
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.
XPathEnvSupport & getXPathEnvSupport()
Retrieve the XPath environment support object.
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
void startElement(const XalanDOMChar *name)
Receive notification of the beginning of an element with an empty attribute list.
const XalanDOMString * getResultPrefixForNamespace(const XalanDOMString &theNamespace) const
Retrieve the result prefix corresponding to a namespace.
XalanVector< const Locator * > LocatorStack
static const XalanDOMString & getXSLNameSpaceURL()
Retrieve the URI for the current XSL namespace, for example, "http://www.w3.org/1999/XSL/Transform".
void characters(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of character data.
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.
XPathExecutionContext::GetCachedString ECGetCachedString
virtual void fireGenerateEvent(const GenerateEvent &ge)
Fire a generate event.
void setPendingElementName(const XalanDOMString &elementName)
Changes the currently pending element name.
void charactersRaw(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of character data.
virtual StylesheetRoot * processStylesheet(const XSLTInputSource &stylesheetSource, StylesheetConstructionContext &constructionContext)
Given a stylesheet input source, compile the stylesheet into an internal representation.
XalanMap< XalanDOMString, XalanParamHolder > ParamMapType
FormatterListener * getFormatterListenerImpl() const
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 XMLParserLiaison & getXMLParserLiaison() const
Get the XML Parser Liaison that this processor uses.
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.
virtual void setExecutionContext(StylesheetExecutionContext *theExecutionContext)
Set the execution context.
void pushOutputContext(FormatterListener *theListener)
const XalanDOMString * getResultNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve the result namespace corresponding to a prefix.
void outputToResultTree(const XObject &value, bool outputTextNodesOnly, const Locator *locator)
Output an object to the result tree by doing the right conversions.
virtual FormatterListener * getFormatterListener() const
Get the current formatter listener.
virtual bool getTraceSelects() const
If this is set to true, simple traces of template calls are made.
static const XalanDOMString & getXalanXSLNameSpaceURL()
Special Xalan namespace for built-in extensions.
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
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...
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.
virtual StylesheetRoot * processStylesheet(const XalanDOMString &xsldocURLString, StylesheetConstructionContext &constructionContext)
Given a URI to an XSL stylesheet, compile the stylesheet into an internal representation.
MemoryManager & getMemoryManager()
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
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.
XPathProcessor & getXPathProcessor()
Get the XPath processor object.
const XObjectPtr evalXPathStr(const XalanDOMString &str, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
AttributeListImpl & getPendingAttributesImpl()
Get the list of attributes yet to be processed.
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.
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.
const AttributeListImpl & getPendingAttributesImpl() const
Get the list of attributes yet to be processed.
bool getQuietConflictWarnings() const
Whether to warn about pattern match conflicts.
XPathConstructionContext::GetCachedString CCGetCachedString
XPathFactory & m_xpathFactory
bool getHasPendingStartDocument() const
XalanVector< bool > BoolVectorType
virtual const XalanDOMString & getURI() const
Retrieve the base URI for the resolver.
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve a namespace corresponding to a prefix.
bool getMustFlushPendingStartDocumentImpl() const
void setPendingElementNameImpl(const XalanDOMChar *elementName)
Changes the currently pending element name.
MemoryManager & getMemoryManager() const
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.
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.
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 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.
void endElement(const XalanDOMChar *name)
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)
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.
virtual const StylesheetRoot * getStylesheetRoot() const
Retrieve the root stylesheet.
void reportDuplicateNamespaceNodeError(const XalanDOMString &theName, const Locator *locator)
Report an error copying a duplicate namespace node.
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.
void cdata(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of cdata.
XalanDOMString & getPendingElementNameImpl()
Retrieve name of the pending element currently being processed.
const XalanDOMString & getPendingElementNameImpl() const
Retrieve name of the pending element currently being processed.
Function::XObjectArgVectorType XObjectArgVectorType
const XPathProcessorPtrType m_xpathProcessor
virtual void getUniqueNamespaceValue(XalanDOMString &theValue)
Generate a random namespace prefix guaranteed to be unique.
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...
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 AttributeListType & getPendingAttributes() const
Get the list of attributes yet to be processed.
const XObjectPtr evalXPathStr(const XalanDOMString &str, XalanNode *contextNode, const XalanElement &prefixResolver, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
ProblemListener * getProblemListener() const
Get the problem listener property.
void startElement(const XalanDOMChar *name, AttributeListType &atts)
static void terminate()
Perform termination of statics.
void setDocumentLocator(const Locator *locator)
const XalanDOMString & getPendingElementName() const
Retrieve name of the pending element currently being processed.
XalanMemMgrAutoPtr< XPathProcessor > XPathProcessorPtrType
XPathFactory & getXPathFactory()
Get the factory for making xpaths.
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 void resolveTopLevelParams(StylesheetExecutionContext &executionContext)
Resolve the params that were pushed by the caller.
This is an interface for an XSLT Processor engine.
const XalanDOMChar * c_str() const
int compare(const XalanDOMString &theString) const
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