Xalan-C++ API Reference  1.12.0
StylesheetExecutionContextDefault.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(STYLESHEETEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680)
19 #define STYLESHEETEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base class include file.
25 
26 
27 
28 #include <ctime>
29 #include <memory>
30 
31 
32 
38 
39 
41 
42 
43 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
45 #endif
46 
47 
48 
50 
51 
52 
54 
55 
56 
57 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
59 #endif
62 
63 
64 
72 
73 
74 
75 namespace XALAN_CPP_NAMESPACE {
76 
77 
78 
79 class XalanSourceTreeDocument;
80 class XPathProcessor;
82 
85 //
86 // An class which provides support for executing stylesheets.
87 //
89 {
90 public:
91 
92  typedef std::clock_t ClockType;
93 
97 
99  typedef std::pair<const XPath*, ClockType> XPathCacheEntry;
102 
105 
106  /**
107  * Construct a StylesheetExecutionContextDefault object
108  *
109  * @param theXPathEnvSupport XPath environment support class instance
110  * @param theDOMSupport DOMSupport class instance
111  * @param theXobjectFactory factory class instance for XObjects
112  * @param theCurrentNode current node in the source tree
113  * @param theContextNodeList node list for current context
114  * @param thePrefixResolver pointer to prefix resolver to use
115  */
117  MemoryManager& theManager,
118  XSLTEngineImpl& xsltProcessor,
119  XPathEnvSupport& theXPathEnvSupport,
120  DOMSupport& theDOMSupport,
121  XObjectFactory& theXObjectFactory,
122  XalanNode* theCurrentNode = 0,
123  const NodeRefListBase* theContextNodeList = 0,
124  const PrefixResolver* thePrefixResolver = 0);
125 
126  /**
127  * Construct a StylesheetExecutionContextDefault object
128  *
129  * @param theXPathEnvSupport XPath environment support class instance
130  * @param theDOMSupport DOMSupport class instance
131  * @param theXobjectFactory factory class instance for XObjects
132  * @param theCurrentNode current node in the source tree
133  * @param theContextNodeList node list for current context
134  * @param thePrefixResolver pointer to prefix resolver to use
135  */
136  explicit
138  MemoryManager& theManager,
139  XalanNode* theCurrentNode = 0,
140  const NodeRefListBase* theContextNodeList = 0,
141  const PrefixResolver* thePrefixResolver = 0);
142 
144  create(
145  MemoryManager& theManager,
146  XalanNode* theCurrentNode = 0,
147  const NodeRefListBase* theContextNodeList = 0,
148  const PrefixResolver* thePrefixResolver = 0);
149 
150  virtual
152 
153 
154  /**
155  * Set the XPathEnvSupport instance.
156  *
157  * @param theSupport a reference to the instance to use.
158  */
159  void
161  {
162  m_xpathExecutionContextDefault.setXPathEnvSupport(theSupport);
163  }
164 
165  /**
166  * Set the DOMSupport instance.
167  *
168  * @param theDOMSupport a reference to the instance to use.
169  */
170  void
171  setDOMSupport(DOMSupport* theDOMSupport)
172  {
173  m_xpathExecutionContextDefault.setDOMSupport(theDOMSupport);
174  }
175 
176  /**
177  * Set the XObjectFactory instance.
178  *
179  * @param theFactory a reference to the instance to use.
180  */
181  void
182  setXObjectFactory(XObjectFactory* theXObjectFactory)
183  {
184  m_xpathExecutionContextDefault.setXObjectFactory(theXObjectFactory);
185 
186  m_xobjectFactory = theXObjectFactory;
187  }
188 
189 
190  /**
191  * Set the DOMSupport instance.
192  *
193  * @param theDOMSupport a reference to the instance to use.
194  */
195  void
197  {
198  m_xsltProcessor = theProcessor;
199  }
200 
201  bool
203  {
204  return m_usePerInstanceDocumentFactory;
205  }
206 
207  void
209  {
210  m_usePerInstanceDocumentFactory = fValue;
211  }
212 
213 
214  // These interfaces are inherited from StylesheetExecutionContext...
215 
216  virtual bool
217  getQuietConflictWarnings() const;
218 
219  virtual bool
220  getCopyTextNodesOnly() const;
221 
222  virtual void
223  pushCopyTextNodesOnly(bool copyTextNodesOnly);
224 
225  virtual bool
226  popCopyTextNodesOnly();
227 
228 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
229  virtual void
230  pushProcessCurrentAttribute(bool processAttribute);
231 
232  virtual bool
233  popProcessCurrentAttribute();
234 
235  virtual void
236  pushSkipElementAttributes(bool skipAttributes);
237 
238  virtual bool
239  getSkipElementAttributes() const;
240 
241  virtual bool
242  popSkipElementAttributes();
243 
244  virtual void
245  pushExecuteIf(bool executeIf);
246 
247  virtual bool
248  popExecuteIf();
249 #endif
250 
251  virtual XalanNode*
252  getRootDocument() const;
253 
254  virtual void
255  setRootDocument(XalanNode* theDocument);
256 
257  virtual void
258  setStylesheetRoot(const StylesheetRoot* theStylesheet);
259 
260  virtual const XalanQName*
261  getCurrentMode() const;
262 
263  virtual void
264  pushCurrentMode(const XalanQName* theMode);
265 
266  virtual void
267  popCurrentMode();
268 
269  virtual const ElemTemplate*
270  getCurrentTemplate() const;
271 
272  virtual void
273  pushCurrentTemplate(const ElemTemplate* theTemplate);
274 
275  virtual void
276  popCurrentTemplate();
277 
278  virtual bool
279  isElementPending() const;
280 
281  virtual void
282  replacePendingAttribute(
283  const XalanDOMChar* theName,
284  const XalanDOMChar* theNewType,
285  const XalanDOMChar* theNewValue);
286 
287  virtual void
288  pushOutputContext(FormatterListener* flistener = 0);
289 
290  virtual void
291  popOutputContext();
292 
293  virtual void
294  addResultAttribute(
295  const XalanDOMString& aname,
296  const XalanDOMString& value);
297 
298  virtual void
299  addResultAttribute(
300  const XalanDOMString& aname,
301  const XalanDOMChar* value);
302 
303  virtual void
304  copyNamespaceAttributes(const XalanNode& src);
305 
306  virtual const XalanDOMString*
307  getResultPrefixForNamespace(const XalanDOMString& theNamespace) const;
308 
309  virtual const XalanDOMString*
310  getResultNamespaceForPrefix(const XalanDOMString& thePrefix) const;
311 
312  virtual bool
313  isPendingResultPrefix(const XalanDOMString& thePrefix);
314 
315  virtual void
316  getUniqueNamespaceValue(XalanDOMString& theValue) const;
317 
318  virtual FormatterListener*
319  getFormatterListener() const;
320 
321  virtual void
322  setFormatterListener(FormatterListener* flistener);
323 
324  virtual int
325  getIndent() const;
326 
327  virtual void
328  setIndent(int indentAmount);
329 
330  virtual const XPath*
331  createMatchPattern(
332  const XalanDOMString& str,
333  const PrefixResolver& resolver);
334 
335  virtual void
336  returnXPath(const XPath* xpath);
337 
338  virtual void
339  pushTopLevelVariables(const ParamVectorType& topLevelParams);
340 
341 
342  virtual const XObjectPtr
343  createVariable(
344  const XPath& xpath,
345  XalanNode* contextNode,
346  const PrefixResolver& resolver);
347 
348 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
349  virtual const XObjectPtr
350  createVariable(
351  const ElemTemplateElement& templateChild,
352  XalanNode* sourceNode);
353 #endif
354 
355  virtual void
356  pushVariable(
357  const XalanQName& name,
358  const ElemTemplateElement* element,
359  const XalanDOMString& str,
360  XalanNode* contextNode,
361  const PrefixResolver& resolver);
362 
363  virtual void
364  pushVariable(
365  const XalanQName& name,
366  const XObjectPtr val,
367  const ElemTemplateElement* element);
368 
369  virtual void
370  pushVariable(
371  const XalanQName& name,
372  const ElemVariable* var,
373  const ElemTemplateElement* element);
374 
375  virtual void
376  pushVariable(
377  const XalanQName& name,
378  const ElemTemplateElement* element,
379  const XPath& xpath,
380  XalanNode* contextNode,
381  const PrefixResolver& resolver);
382 
383 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
384  virtual void
385  pushVariable(
386  const XalanQName& name,
387  const ElemTemplateElement* element,
388  const ElemTemplateElement& templateChild,
389  XalanNode* sourceNode);
390 #endif
391 
392 
393  virtual void
394  pushContextMarker();
395 
396  virtual void
397  popContextMarker();
398 
399  virtual void
400  resolveTopLevelParams();
401 
402  virtual void
403  clearTopLevelParams();
404 
405 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
406  virtual void beginParams();
407 
408  virtual void endParams();
409 
410  virtual void pushParam(const XalanQName& qName,const XObjectPtr& theValue);
411 #else
412  virtual void
413  pushParams(const ElemTemplateElement& xslCallTemplateElement);
414 #endif
415 
416  virtual const XObjectPtr
417  getParamVariable(const XalanQName& theName);
418 
419  virtual void
420  pushElementFrame(const ElemTemplateElement* elem);
421 
422  virtual void
423  popElementFrame();
424 
425  virtual int
426  getGlobalStackFrameIndex() const;
427 
428  virtual int
429  getCurrentStackFrameIndex() const;
430 
431  virtual void
432  pushCurrentStackFrameIndex(int currentStackFrameIndex = -1);
433 
434  virtual void
435  popCurrentStackFrameIndex();
436 
437  virtual void
438  startDocument();
439 
440  virtual void
441  endDocument();
442 
443  virtual void
444  startElement(const XalanDOMChar* name);
445 
446  virtual void
447  endElement(const XalanDOMChar* name);
448 
449  virtual void
450  characters(
451  const XalanDOMChar* ch,
452  fl_size_type start,
453  fl_size_type length);
454 
455  virtual void
456  charactersRaw(
457  const XalanDOMChar* ch,
458  fl_size_type start,
459  fl_size_type length);
460 
461  virtual void
462  comment(const XalanDOMChar* data);
463 
464  virtual void
465  processingInstruction(
466  const XalanDOMChar* target,
467  const XalanDOMChar* data);
468 
469  virtual void
470  flushPending();
471 
472  virtual void
473  cloneToResultTree(
474  const XalanNode& node,
475  const Locator* locator);
476 
477  virtual void
478  cloneToResultTree(
479  const XalanNode& node,
480  XalanNode::NodeType nodeType,
481  bool overrideStrip,
482  bool shouldCloneAttributes,
483  const Locator* locator);
484 
485 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
486  virtual void
487  beginCreateXResultTreeFrag(XalanNode* sourceNode);
488 
489  virtual const XObjectPtr
490  endCreateXResultTreeFrag();
491 
492  virtual void
493  beginFormatToText(XalanDOMString& theResult);
494 
495  virtual void
496  endFormatToText();
497 #endif
498 
499 
500 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
501  virtual const XObjectPtr
502  createXResultTreeFrag(
503  const ElemTemplateElement& templateChild,
504  XalanNode* sourceNode);
505 #endif
506 
507  virtual void
508  outputToResultTree(
509  const XObject& xobj,
510  const Locator* locator);
511 
512  virtual void
513  outputResultTreeFragment(
514  const XObject& theTree,
515  const Locator* locator);
516 
517  virtual const XalanDOMString&
518  getXSLNameSpaceURL() const;
519 
520  virtual const XalanDOMString&
521  getXalanXSLNameSpaceURL() const;
522 
523  virtual bool
524  findOnElementRecursionStack(const ElemTemplateElement* theElement) const;
525 
526  virtual void
527  pushOnElementRecursionStack(const ElemTemplateElement* theElement);
528 
529  virtual const ElemTemplateElement*
530  popElementRecursionStack();
531 
532  virtual bool
533  returnXResultTreeFrag(XResultTreeFrag* theXResultTreeFrag);
534 
535  virtual eEscapeURLs
536  getEscapeURLs() const;
537 
538  virtual void
539  setEscapeURLs(eEscapeURLs value);
540 
541  virtual eOmitMETATag
542  getOmitMETATag() const;
543 
544  void
545  setOmitMETATag(eOmitMETATag value);
546 
547  virtual FormatterListener*
548  createFormatterToXML(
549  Writer& writer,
550  const XalanDOMString& version = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
551  bool doIndent = false,
552  int indent = eDefaultXMLIndentAmount,
553  const XalanDOMString& encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
554  const XalanDOMString& mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
555  const XalanDOMString& doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
556  const XalanDOMString& doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
557  bool xmlDecl = true,
558  const XalanDOMString& standalone = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
559 
560  virtual FormatterListener*
561  createFormatterToHTML(
562  Writer& writer,
563  const XalanDOMString& encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
564  const XalanDOMString& mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
565  const XalanDOMString& doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
566  const XalanDOMString& doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
567  bool doIndent = true,
568  int indent = eDefaultHTMLIndentAmount,
569  bool escapeURLs = true,
570  bool omitMetaTag = false);
571 
572  virtual FormatterListener*
573  createFormatterToText(
574  Writer& writer,
575  const XalanDOMString& encoding);
576 
577 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
578  virtual NodeSorter*
579  getNodeSorter();
580 #else
581  virtual NodeSorter*
582  borrowNodeSorter();
583 
584  virtual bool
585  returnNodeSorter(NodeSorter* theSorter);
586 #endif
587 
588  virtual XalanNumberFormatAutoPtr
589  createXalanNumberFormat();
590 
591  // A basic class to create XalanNumberFormat instances...
593  {
594  public:
595 
596  explicit
598 
599  virtual
601 
602  virtual XalanNumberFormat*
603  create(MemoryManager& theManager);
604  };
605 
608  {
609  return s_defaultXalanNumberFormatFactory;
610  }
611 
612  /**
613  * Static function to install a new XalanNumberFormatFactory.
614  * The caller owns the XalanNumberFormatFactory instance.
615  *
616  * @param a pointer to the new factory instance to use.
617  * @return a pointer to the old factory instance.
618  */
619  static XalanNumberFormatFactory*
620  installXalanNumberFormatFactory(XalanNumberFormatFactory* theFactory);
621 
622 
623  virtual tl_size_type
624  getTraceListeners() const;
625 
626  virtual void
627  fireGenerateEvent(const GenerateEvent& ge);
628 
629  virtual void
630  fireTraceEvent(const TracerEvent& te);
631 
632  virtual void
633  fireSelectEvent(const SelectionEvent& se);
634 
635  virtual bool
636  getTraceSelects() const;
637 
638  virtual void
639  traceSelect(
640  const ElemTemplateElement& theStylesheetElement,
641  const NodeRefListBase& nl,
642  const XPath* xpath);
643 
644  virtual int
646  const XalanDOMString& theLHS,
647  const XalanDOMString& theRHS,
648  XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault);
649 
650  virtual int
652  const XalanDOMString& theLHS,
653  const XalanDOMString& theRHS,
654  const XalanDOMString& theLocale,
655  XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault);
656 
657  virtual int
659  const XalanDOMChar* theLHS,
660  const XalanDOMChar* theRHS,
661  XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault);
662 
663  virtual int
665  const XalanDOMChar* theLHS,
666  const XalanDOMChar* theRHS,
667  const XalanDOMChar* theLocale,
668  XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault);
669 
671 
673  {
674  public:
675 
677 
678  virtual
680 
681  virtual int
682  operator()(
683  const XalanDOMChar* theLHS,
684  const XalanDOMChar* theRHS,
685  XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault) const;
686 
687  virtual int
688  operator()(
689  const XalanDOMChar* theLHS,
690  const XalanDOMChar* theRHS,
691  const XalanDOMChar* theLocale,
692  XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault) const;
693  };
694 
695 
697  installCollationCompareFunctor(CollationCompareFunctor* theFunctor);
698 
700  uninstallCollationCompareFunctor();
701 
702 
704  {
705  public:
706 
708 
709  virtual
711 
712  virtual void
713  operator() (
714  XPathExecutionContext& executionContext,
715  double theNumber,
716  const XalanDOMString& thePattern,
717  const XalanDecimalFormatSymbols* theDFS,
718  XalanDOMString& theResult,
719  const XalanNode* context = 0,
720  const Locator* locator = 0) const = 0;
721  };
722 
723  virtual void
724  formatNumber(
725  double number,
726  const XalanDOMString& pattern,
727  XalanDOMString& theResult,
728  const XalanNode* context = 0,
729  const Locator* locator = 0);
730 
731  virtual void
732  formatNumber(
733  double number,
734  const XalanDOMString& pattern,
735  const XalanDOMString& dfsName,
736  XalanDOMString& theResult,
737  const XalanNode* context = 0,
738  const Locator* locator = 0);
739 
740 
741  const FormatNumberFunctor*
742  installFormatNumberFunctor(FormatNumberFunctor* formatNumberFunctor);
743 
745  uninstallFormatNumberFunctor();
746 
747  virtual PrintWriter*
748  createPrintWriter(XalanOutputStream* theTextOutputStream);
749 
750  virtual PrintWriter*
751  createPrintWriter(
752  const XalanDOMString& theFileName,
753  const XalanDOMString& theEncoding);
754 
755  virtual PrintWriter*
756  createPrintWriter(StreamType& theStream);
757 
758  virtual PrintWriter*
759  createPrintWriter(FILE* theStream);
760 
761  virtual CountersTable&
762  getCountersTable();
763 
764  virtual void
765  characters(const XalanNode& node);
766 
767  virtual void
768  characters(const XObjectPtr& xobject);
769 
770  virtual void
771  charactersRaw(const XalanNode& node);
772 
773  virtual void
774  charactersRaw(const XObjectPtr& xobject);
775 
776 
777  // These interfaces are inherited from XPathExecutionContext...
778 
779  virtual void
780  reset();
781 
782  virtual XalanNode*
783  getCurrentNode() const;
784 
785  virtual void
786  pushCurrentNode(XalanNode* theCurrentNode);
787 
788  virtual void
789  popCurrentNode();
790 
791  virtual bool
792  isNodeAfter(
793  const XalanNode& node1,
794  const XalanNode& node2) const;
795 
796  virtual void
797  pushContextNodeList(const NodeRefListBase& theList);
798 
799  virtual void
800  popContextNodeList();
801 
802  virtual const NodeRefListBase&
803  getContextNodeList() const;
804 
805  virtual size_type
806  getContextNodeListLength() const;
807 
808  virtual size_type
809  getContextNodeListPosition(const XalanNode& contextNode) const;
810 
811  virtual bool
812  elementAvailable(const XalanQName& theQName) const;
813 
814  virtual bool
815  elementAvailable(
816  const XalanDOMString& theName,
817  const Locator* locator) const;
818 
819  virtual bool
820  functionAvailable(const XalanQName& theQName) const;
821 
822  virtual bool
823  functionAvailable(
824  const XalanDOMString& theName,
825  const Locator* locator) const;
826 
827  virtual const XObjectPtr
828  extFunction(
829  const XalanDOMString& theNamespace,
830  const XalanDOMString& functionName,
831  XalanNode* context,
832  const XObjectArgVectorType& argVec,
833  const Locator* locator);
834 
835  virtual XalanDocument*
836  parseXML(
837  MemoryManager& theManager,
838  const XalanDOMString& urlString,
839  const XalanDOMString& base,
840  ErrorHandler* theErrorHandler = 0) const;
841 
842  virtual MutableNodeRefList*
843  borrowMutableNodeRefList();
844 
845  virtual bool
846  returnMutableNodeRefList(MutableNodeRefList* theList);
847 
848  virtual MutableNodeRefList*
849  createMutableNodeRefList(MemoryManager& theManager) const;
850 
851 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
852  virtual void
853  createUseAttributeSetIndexesOnStack();
854 
855  virtual UseAttributeSetIndexes&
856  getUseAttributeSetIndexes();
857 
858  virtual void
859  popUseAttributeSetIndexesFromStack();
860 
861  virtual void
862  pushInvoker(const ElemTemplateElement * invoker);
863 
864  virtual void
865  popInvoker();
866 
867  virtual const ElemTemplateElement*
868  getInvoker() const;
869 
870  virtual MutableNodeRefList&
871  createAndPushMutableNodeRefList();
872 
873  virtual void
874  releaseAndPopMutableNodeRefList();
875 
876  virtual void
877  pushXObjectPtr(const XObjectPtr& xobjectPtr);
878 
879  virtual void
880  popXObjectPtr();
881 
882  virtual void
883  createAndPushNodesToTransformList(const NodeRefListBase* nodeList);
884 
885  virtual XalanNode*
886  getNextNodeToTransform();
887 
888  virtual void
889  popNodesToTransformList();
890 
891  virtual XalanDOMString&
892  getAndPushCachedString();
893 
894  virtual XalanDOMString&
895  getLastCachedString();
896 
897  virtual XalanDOMString&
898  getAndPopCachedString();
899 #endif
900 
901  virtual XalanDOMString&
902  getCachedString();
903 
904  virtual bool
905  releaseCachedString(XalanDOMString& theString);
906 
907 
908  virtual void
909  getNodeSetByKey(
910  XalanNode* context,
911  const XalanQName& qname,
912  const XalanDOMString& ref,
913  const Locator* locator,
914  MutableNodeRefList& nodelist);
915 
916  virtual void
917  getNodeSetByKey(
918  XalanNode* context,
919  const XalanDOMString& name,
920  const XalanDOMString& ref,
921  const Locator* locator,
922  MutableNodeRefList& nodelist);
923 
924  virtual const XObjectPtr
925  getVariable(
926  const XalanQName& name,
927  const Locator* locator = 0);
928 
929  virtual const PrefixResolver*
930  getPrefixResolver() const;
931 
932  virtual void
933  setPrefixResolver(const PrefixResolver* thePrefixResolver);
934 
935  virtual const XalanDOMString*
936  getNamespaceForPrefix(const XalanDOMString& prefix) const;
937 
938  virtual const XalanDOMString&
939  findURIFromDoc(const XalanDocument* owner) const;
940 
941  virtual const XalanDOMString&
942  getUnparsedEntityURI(
943  const XalanDOMString& theName,
944  const XalanDocument& theDocument) const;
945 
946  virtual bool
947  shouldStripSourceNode(const XalanText& node);
948 
949  virtual XalanDocument*
950  getSourceDocument(const XalanDOMString& theURI) const;
951 
952  virtual void
953  setSourceDocument(
954  const XalanDOMString& theURI,
955  XalanDocument* theDocument);
956 
957  // These interfaces are inherited from ExecutionContext...
958  virtual void
959  problem(
960  eSource source,
961  eClassification classification,
962  const XalanDOMString& msg,
963  const Locator* locator,
964  const XalanNode* sourceNode);
965 
966  virtual void
967  problem(
968  eSource source,
969  eClassification classification,
970  const XalanDOMString& msg,
971  const XalanNode* sourceNode);
972 
974  {
975  public:
976 
978  m_xsltProcessor(xsltProcessor)
979  {
980  }
981 
982  void
983  operator()(const XPathCacheMapType::value_type& theCacheEntry);
984 
985  private:
986 
987  XSLTEngineImpl& m_xsltProcessor;
988  };
989 
990  /**
991  * Get a XalanSourceTreeDocument, primarily for creating result
992  * tree fragments.
993  */
995  getSourceTreeFactory(MemoryManager& theManager) const;
996 
997 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
998 protected:
999 
1000  virtual FormatterToText*
1001  borrowFormatterToText();
1002 
1003  virtual bool
1004  returnFormatterToText(FormatterToText* theFormatter);
1005 #endif
1006 
1007 private:
1008 
1010  getDecimalFormatSymbols(const XalanQName& qname);
1011 
1012 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
1013  /**
1014  * Given a context, create the params for a template
1015  * call.
1016  *
1017  * @param xslCallTemplateElement "call-template" element
1018  * @param params The params
1019  */
1020  void
1021  getParams(
1022  const ElemTemplateElement& xslCallTemplateElement,
1023  ParamsVectorType& params);
1024 #endif
1025 
1026  /**
1027  * Determine if the XPath is one that we have cached.
1028  *
1029  * @param theXPath the XPath instance to check
1030  * @return true if the instance has been cached, false if not.
1031  */
1032  bool
1033  isCached(const XPath* theXPath);
1034 
1035  /**
1036  * Clear out the cache of XPath instances.
1037  */
1038  void
1039  clearXPathCache();
1040 
1041  /**
1042  * Add an XPath instance to the cache, clearing out an old entry
1043  * if the cache is full.
1044  *
1045  * @param pattern the key for looking up the XPath instance in the cache.
1046  * @param theXPath the XPath instance to cache
1047  */
1048  void
1049  addToXPathCache(
1050  const XalanDOMString& pattern,
1051  const XPath* theXPath);
1052 
1053 
1054  /**
1055  * Clean up anything that was created for use only during the transformation.
1056  */
1057  void
1058  cleanUpTransients();
1059 
1060  XPathExecutionContextDefault m_xpathExecutionContextDefault;
1061 
1062  XSLTEngineImpl* m_xsltProcessor;
1063 
1064  XalanNode* m_rootDocument;
1065 
1066  enum { eXPathCacheMax = 50,
1067  eDefaultParamsVectorSize = 10,
1068  eXResultTreeFragAllocatorBlockSize = 10,
1069  eDocumentAllocatorBlockSize = 10,
1070  eDocumentFragmentAllocatorBlockSize = 10,
1071  eDefaultAttributeAllocatorBlockSize = 10,
1072  eDefaultAttributeNSAllocatorBlockSize = 10,
1073  eDefaultCommentAllocatorBlockSize = 10,
1074  eDefaultElementAllocatorBlockSize = 10,
1075  eDefaultElementNSAllocatorBlockSize = 10,
1076  eDefaultPIAllocatorBlockSize = 10,
1077  eDefaultTextAllocatorBlockSize = 20,
1078  eDefaultTextIWSAllocatorBlockSize = 20 };
1079 
1080  ElementTemplateElementStackType m_elementRecursionStack;
1081 
1082  const StylesheetRoot* m_stylesheetRoot;
1083 
1084  FormatterListenerVectorType m_formatterListeners;
1085 
1086  PrintWriterVectorType m_printWriters;
1087 
1088  OutputStreamVectorType m_outputStreams;
1089 
1090  CollationCompareFunctor* m_collationCompareFunctor;
1091 
1092  FormatNumberFunctor * m_formatNumberFunctor;
1093 
1094  /**
1095  * Holds all information about variables during execution.
1096  */
1097  VariablesStack m_variablesStack;
1098 
1099  ParamsVectorType m_paramsVector;
1100 
1101  XPathCacheMapType m_matchPatternCache;
1102 
1103  KeyTablesTableType m_keyTables;
1104 
1105  CountersTable m_countersTable;
1106 
1107  /**
1108  * The factory that will be used to create result tree fragments based on our
1109  * internal source tree.
1110  */
1111  mutable XalanMemMgrAutoPtr<XalanSourceTreeDocument> m_sourceTreeResultTreeFactory;
1112 
1113  // Holds the current mode.
1114  const XalanQName* m_mode;
1115 
1116  CurrentTemplateStackType m_currentTemplateStack;
1117 
1118  int m_indentAmount;
1119 
1120  XResultTreeFragAllocator m_xresultTreeFragAllocator;
1121 
1122  XalanSourceTreeDocumentFragmentAllocator m_documentFragmentAllocator;
1123 
1124  XalanSourceTreeDocumentAllocator m_documentAllocator;
1125 
1126  typedef XalanVector<bool> BooleanStackType;
1127  typedef XalanVector<const XalanQName*> ModeStackType;
1128  typedef XalanVector<int> IntStackType;
1129 
1130  BooleanStackType m_copyTextNodesOnlyStack;
1131  ModeStackType m_modeStack;
1132  IntStackType m_currentIndexStack;
1133 
1134 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
1135  typedef XalanMemoryManagerObjectCacheDefault<FormatterToText> FormatterToTextCacheType;
1136  typedef XalanMemoryManagerObjectCacheDefault<FormatterToSourceTree> FormatterToSourceTreeCacheType;
1137  typedef XalanMemoryManagerObjectCacheDefault<NodeSorter> NodeSorterCacheType;
1138 
1139  FormatterToTextCacheType m_formatterToTextCache;
1140 
1141  FormatterToSourceTreeCacheType m_formatterToSourceTreeCache;
1142 
1143  NodeSorterCacheType m_nodeSorterCache;
1144 #else
1145 
1146  class FormatterToTextDOMString : public FormatterToText
1147  {
1148  public:
1149 
1150  FormatterToTextDOMString(MemoryManager& theManager);
1151 
1152  virtual
1153  ~FormatterToTextDOMString();
1154 
1155  void
1156  setDOMString(XalanDOMString& theString)
1157  {
1158  m_printWriter.setString(theString);
1159  }
1160 
1161  private:
1162 
1163  // These are not defined...
1164  FormatterToTextDOMString(const FormatterToTextDOMString&);
1165 
1166  FormatterToTextDOMString&
1167  operator=(const FormatterToTextDOMString&);
1168 
1169  bool
1170  operator==(const FormatterToTextDOMString&) const;
1171 
1172 
1173  // Data members...
1174  DOMStringPrintWriter m_printWriter;
1175 
1176  static XalanDOMString s_dummyString;
1177  };
1178 
1179  typedef XalanVector<XObjectPtr> XObjectPtrStackType;
1180  typedef XalanVector<ParamsVectorType> ParamsVectorStackType;
1181  typedef XalanVector<UseAttributeSetIndexes> UseAttributeSetIndexesStackType;
1182  typedef XalanObjectStackCache<MutableNodeRefList,DefaultCacheCreateFunctorMemMgr<MutableNodeRefList> >
1183  MutableNodeRefListStackType;
1184 
1185  typedef XalanObjectStackCache<XalanDOMString,DefaultCacheCreateFunctorMemMgr<XalanDOMString> >
1186  StringStackType;
1187 
1188  typedef XalanObjectStackCache<FormatterToTextDOMString,DefaultCacheCreateFunctorMemMgr<FormatterToTextDOMString> >
1189  FormatterToTextStackType;
1190  typedef XalanObjectStackCache<FormatterToSourceTree,DefaultCacheCreateFunctorMemMgr<FormatterToSourceTree> >
1191  FormatterToSourceTreeStackType;
1192 
1193  /*
1194  * class to maintain the list of nodes to be transformed by an element
1195  */
1196  class NodesToTransform
1197  {
1198  public:
1199  NodesToTransform(const NodeRefListBase* nodeList) :
1200  m_nodeList(nodeList), m_index(0)
1201  {
1202  assert(m_nodeList != 0);
1203  }
1204 
1205  const NodeRefListBase* operator() ()
1206  {
1207  return m_nodeList;
1208  }
1209 
1211  {
1212  return m_index;
1213  }
1214 
1215  XalanNode* next()
1216  {
1217  if (m_index < m_nodeList->getLength())
1218  {
1219  return m_nodeList->item(m_index++);
1220  }
1221  return 0;
1222  }
1223 
1224  private:
1225  const NodeRefListBase* m_nodeList;
1227  };
1228 
1229  typedef XalanVector<NodesToTransform> NodesToTransformStackType;
1230 
1231  XObjectPtrStackType m_xobjectPtrStack;
1232  MutableNodeRefListStackType m_mutableNodeRefListStack;
1233  NodesToTransformStackType m_nodesToTransformStack;
1234  BooleanStackType m_processCurrentAttributeStack;
1235  BooleanStackType m_executeIfStack;
1236  StringStackType m_stringStack;
1237  FormatterToTextStackType m_formatterToTextStack;
1238  BooleanStackType m_skipElementAttributesStack;
1239  FormatterToSourceTreeStackType m_formatterToSourceTreeStack;
1240  ParamsVectorStackType m_paramsVectorStack;
1241  ElementTemplateElementStackType m_elementInvokerStack;
1242  UseAttributeSetIndexesStackType m_useAttributeSetIndexesStack;
1243 
1244  NodeSorter m_nodeSorter;
1245 #endif
1246 
1247  // If true, we will use a separate document factory for
1248  // result tree fragments.
1249  bool m_usePerInstanceDocumentFactory;
1250 
1251  // Determines whether or not to override the property in the stylesheet.
1252  eEscapeURLs m_escapeURLs;
1253 
1254  // Determines whether or not to override the property in the stylesheet.
1255  eOmitMETATag m_omitMETATag;
1256 
1257  static XalanNumberFormatFactory s_defaultXalanNumberFormatFactory;
1258 
1259  static XalanNumberFormatFactory* s_xalanNumberFormatFactory;
1260 
1261  static const DefaultCollationCompareFunctor s_defaultCollationFunctor;
1262 };
1263 
1264 
1265 
1266 }
1267 
1268 
1269 
1270 #endif // STYLESHEETEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
FormatterToSourceTree.hpp
xalanc::XResultTreeFrag
Definition: XResultTreeFrag.hpp:50
xalanc::StylesheetExecutionContextDefault::FormatNumberFunctor::FormatNumberFunctor
FormatNumberFunctor()
Definition: StylesheetExecutionContextDefault.hpp:707
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::StylesheetExecutionContextDefault::XPathCacheEntry
std::pair< const XPath *, ClockType > XPathCacheEntry
Definition: StylesheetExecutionContextDefault.hpp:99
xalanc::NodeSorter
This class can sort vectors of nodes according to a select pattern.
Definition: NodeSorter.hpp:62
xalanc::XalanNumberFormat
Definition: XalanNumberFormat.hpp:36
xalanc::StylesheetExecutionContext
Definition: StylesheetExecutionContext.hpp:106
xalanc::StylesheetExecutionContextDefault::ParamsVectorType
ParamsVectorTypeDecl ParamsVectorType
Definition: StylesheetExecutionContextDefault.hpp:104
xalanc::StylesheetExecutionContextDefault::XPathCacheReturnFunctor
Definition: StylesheetExecutionContextDefault.hpp:973
xalanc::XalanNode
Definition: XalanNode.hpp:38
xalanc::XalanNode::NodeType
NodeType
Definition: XalanNode.hpp:47
xalanc::XalanVector
Definition: XalanVector.hpp:58
xalanc::XalanText
Definition: XalanText.hpp:40
XalanSourceTreeDocument.hpp
XALAN_USES_MEMORY_MANAGER
#define XALAN_USES_MEMORY_MANAGER(Type)
Definition: XalanMemoryManagement.hpp:589
xalanc::XalanDecimalFormatSymbols
Definition: XalanDecimalFormatSymbols.hpp:40
xalanc::FormatterToText
This class takes SAX events (in addition to some extra events that SAX doesn't handle yet) and produc...
Definition: FormatterToText.hpp:49
xalanc::XPath
Definition: XPath.hpp:67
xalanc::MutableNodeRefList
Local implementation of MutableNodeRefList.
Definition: MutableNodeRefList.hpp:46
XALAN_XSLT_EXPORT
#define XALAN_XSLT_EXPORT
Definition: XSLTDefinitions.hpp:27
xalanc::StylesheetExecutionContextDefault::CurrentTemplateStackType
XalanVector< const ElemTemplate * > CurrentTemplateStackType
Definition: StylesheetExecutionContextDefault.hpp:101
XalanSourceTreeDocumentAllocator.hpp
xalanc::XalanDocument
Definition: XalanDocument.hpp:36
xalanc::size_type
size_t size_type
Definition: XalanMap.hpp:46
xalanc::ElemTemplateElement
Definition: ElemTemplateElement.hpp:79
xalanc::StylesheetExecutionContextDefault::XPathCacheReturnFunctor::XPathCacheReturnFunctor
XPathCacheReturnFunctor(XSLTEngineImpl &xsltProcessor)
Definition: StylesheetExecutionContextDefault.hpp:977
XalanObjectStackCache.hpp
XalanVector.hpp
XalanSourceTreeDocumentFragment.hpp
xalanc::StylesheetExecutionContextDefault::setXObjectFactory
void setXObjectFactory(XObjectFactory *theXObjectFactory)
Set the XObjectFactory instance.
Definition: StylesheetExecutionContextDefault.hpp:182
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1118
NodeSorter.hpp
xalanc::StylesheetExecutionContextDefault::CollationCompareFunctor
XalanCollationServices::CollationCompareFunctor CollationCompareFunctor
Definition: StylesheetExecutionContextDefault.hpp:670
xalanc::XObjectPtr
Class to hold XObjectPtr return types.
Definition: XObject.hpp:883
xalanc::XalanOutputStream
Definition: XalanOutputStream.hpp:49
xalanc::StylesheetExecutionContextDefault::FormatNumberFunctor::~FormatNumberFunctor
virtual ~FormatNumberFunctor()
Definition: StylesheetExecutionContextDefault.hpp:710
xalanc::XSLTEngineImpl
It's the responsibility of the XSLTEngineImpl class, collaborating with the XML parser liaison,...
Definition: XSLTEngineImpl.hpp:131
DOMStringHelper.hpp
CountersTable.hpp
xalanc::SelectionEvent
Definition: SelectionEvent.hpp:47
xalanc::StylesheetExecutionContextDefault::ElementTemplateElementStackType
XalanVector< const ElemTemplateElement * > ElementTemplateElementStackType
Definition: StylesheetExecutionContextDefault.hpp:98
xalanc::XalanCollationServices::eCaseOrder
eCaseOrder
Definition: XalanCollationServices.hpp:40
XalanSourceTreeDocumentFragmentAllocator.hpp
xalanc::StylesheetExecutionContextDefault::OutputStreamVectorType
XalanVector< XalanOutputStream * > OutputStreamVectorType
Definition: StylesheetExecutionContextDefault.hpp:96
xalanc::StylesheetExecutionContextDefault::PrintWriterVectorType
XalanVector< PrintWriter * > PrintWriterVectorType
Definition: StylesheetExecutionContextDefault.hpp:95
xalanc::StylesheetExecutionContextDefault::XalanNumberFormatFactory
Definition: StylesheetExecutionContextDefault.hpp:592
xalanc::StylesheetExecutionContextDefault::setDOMSupport
void setDOMSupport(DOMSupport *theDOMSupport)
Set the DOMSupport instance.
Definition: StylesheetExecutionContextDefault.hpp:171
xalanc::StylesheetExecutionContextDefault::DefaultCollationCompareFunctor
Definition: StylesheetExecutionContextDefault.hpp:672
xalanc::XObject
Class to hold XPath return types.
Definition: XObject.hpp:63
xalanc::length
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
Definition: DOMStringHelper.hpp:235
VariablesStack.hpp
xalanc::XPathExecutionContextDefault
A basic implementation of the class XPathExecutionContext.
Definition: XPathExecutionContextDefault.hpp:64
XalanObjectCache.hpp
xalanc::PrefixResolver
This class defines an interface for classes that resolve namespace prefixes to their URIs.
Definition: PrefixResolver.hpp:39
xalanc::ElemVariable
Definition: ElemVariable.hpp:47
xalanc::PrintWriter
Definition: PrintWriter.hpp:37
xalanc::StylesheetExecutionContextDefault::ClockType
std::clock_t ClockType
Definition: StylesheetExecutionContextDefault.hpp:92
xalanc::DOMSupport
Definition: DOMSupport.hpp:41
xalanc::StylesheetExecutionContextDefault::KeyTablesTableType
Stylesheet::KeyTablesTableType KeyTablesTableType
Definition: StylesheetExecutionContextDefault.hpp:103
xalanc::StylesheetExecutionContextDefault::FormatNumberFunctor
Definition: StylesheetExecutionContextDefault.hpp:703
xalanc::XalanMap< XalanDOMString, XPathCacheEntry >
xalanc::StylesheetExecutionContextDefault::getDefaultXalanNumberFormatFactory
static XalanNumberFormatFactory & getDefaultXalanNumberFormatFactory()
Definition: StylesheetExecutionContextDefault.hpp:607
xalanc::TracerEvent
This is the parent class of events generated for tracing the progress of the XSL processor.
Definition: TracerEvent.hpp:49
XalanMap.hpp
FormatterToText.hpp
xalanc::StylesheetExecutionContextDefault::setXSLTProcessor
void setXSLTProcessor(XSLTEngineImpl *theProcessor)
Set the DOMSupport instance.
Definition: StylesheetExecutionContextDefault.hpp:196
xalanc::ElemTemplate
Definition: ElemTemplate.hpp:43
xalanc::StylesheetRoot
This acts as the stylesheet root of the stylesheet tree, and holds values that are shared by all styl...
Definition: StylesheetRoot.hpp:63
xalanc::FormatNumberFunctor
StylesheetExecutionContextDefault::FormatNumberFunctor FormatNumberFunctor
Definition: ICUFormatNumberFunctor.hpp:51
xalanc::XPathEnvSupport
Definition: XPathEnvSupport.hpp:60
xalanc::StylesheetExecutionContextDefault::XPathCacheMapType
XalanMap< XalanDOMString, XPathCacheEntry > XPathCacheMapType
Definition: StylesheetExecutionContextDefault.hpp:100
xalanc::StylesheetExecutionContextDefault::setXPathEnvSupport
void setXPathEnvSupport(XPathEnvSupport *theSupport)
Set the XPathEnvSupport instance.
Definition: StylesheetExecutionContextDefault.hpp:160
xalanc::FormatterListener
A SAX-based formatter interface for the XSL processor.
Definition: FormatterListener.hpp:56
xalanc::XPathExecutionContext
Definition: XPathExecutionContext.hpp:82
xalanc::NodeRefListBase
Local implementation of NodeRefList.
Definition: NodeRefListBase.hpp:44
xalanc::CountersTable
<meta name="usage" content="internal"> This is a table of counters, keyed by ElemNumber objects,...
Definition: CountersTable.hpp:157
xalanc::XalanQName
Class to represent a qualified name.
Definition: XalanQName.hpp:70
xalanc::GenerateEvent
This is the class for events generated by the XSL processor after it generates a new node in the resu...
Definition: GenerateEvent.hpp:55
xalanc::collationCompare
collationCompare(const XalanDOMChar *theLHS, XalanDOMString::size_type theLHSLength, const XalanDOMChar *theRHS, XalanDOMString::size_type theRHSLength)
Compare the contents of two character arrays.
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45
xalanc::StylesheetExecutionContextDefault::setUsePerInstanceDocumentFactory
void setUsePerInstanceDocumentFactory(bool fValue)
Definition: StylesheetExecutionContextDefault.hpp:208
xalanc::XalanCollationServices::CollationCompareFunctor
Definition: XalanCollationServices.hpp:42
xalanc::StylesheetExecutionContextDefault::getUsePerInstanceDocumentFactory
bool getUsePerInstanceDocumentFactory() const
Definition: StylesheetExecutionContextDefault.hpp:202
XPathExecutionContextDefault.hpp
xalanc::XalanSourceTreeDocument
Definition: XalanSourceTreeDocument.hpp:78
StylesheetExecutionContext.hpp
xalanc::XalanMap< XalanDOMString, XPathCacheEntry >::value_type
std::pair< const key_type, data_type > value_type
Definition: XalanMap.hpp:201
xalanc::XObjectFactory
This class handles the creation of XObjects and manages their lifetime.
Definition: XObjectFactory.hpp:53
XResultTreeFragAllocator.hpp
xalanc::StylesheetExecutionContextDefault::FormatterListenerVectorType
XalanVector< FormatterListener * > FormatterListenerVectorType
Definition: StylesheetExecutionContextDefault.hpp:94
Stylesheet.hpp
DOMStringPrintWriter.hpp
XalanSet.hpp
xalanc::StylesheetExecutionContextDefault
Definition: StylesheetExecutionContextDefault.hpp:88
xalanc::Writer
Definition: Writer.hpp:44
xalanc::ParamsVectorTypeDecl
VariablesStack::ParamsVectorType ParamsVectorTypeDecl
Definition: StylesheetExecutionContextDefault.hpp:81