Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

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

Interpreting class diagrams

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

dot

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

Apache Logo