Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


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

Interpreting class diagrams

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

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

Apache Logo