Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


StylesheetExecutionContext.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(STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680)
19 #define STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
28 #include <cstddef>
29 #include <cstdio>
30 #include <memory>
31 
32 
33 
34 // Base class header file...
36 
37 
38 
39 
41 
42 
43 
44 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
46 #endif
47 
48 
49 
51 
52 
53 
54 
58 
59 
60 
62 
63 
64 
65 XALAN_CPP_NAMESPACE_BEGIN
66 
67 
68 
69 #if defined(XALAN_STRICT_ANSI_HEADERS)
70 using std::FILE;
71 #endif
72 
73 
74 
75 class CountersTable;
76 class ElemTemplate;
78 class ElemVariable;
79 class FormatterListener;
80 class FormatterToText;
81 class GenerateEvent;
82 class PrefixResolver;
83 class NodeRefListBase;
84 class NodeSorter;
85 class PrintWriter;
86 class XalanQName;
87 class SelectionEvent;
88 class Stylesheet;
89 class StylesheetRoot;
90 class XalanOutputStream;
91 class TracerEvent;
92 class Writer;
93 class XalanDocument;
95 class XalanElement;
96 class XalanNode;
97 class XalanNumberFormat;
98 class XPath;
99 class XObject;
100 class XObjectPtr;
101 class XResultTreeFrag;
102 
103 
104 
105 //
106 // An abstract class which provides support for executing stylesheets.
107 //
109 {
110 public:
111 
112  typedef XalanSize_t tl_size_type;
113 
115 
116 #if defined(XALAN_NO_STD_NAMESPACE)
117  typedef ostream StreamType;
118 #else
119  typedef std::ostream StreamType;
120 #endif
121 
122  explicit
124  MemoryManager& theMemoryManager,
125  XObjectFactory* theXObjectFactory = 0);
126 
127  virtual
129 
130  // These interfaces are new...
131 
132  /**
133  * Determine whether conflicts should be reported.
134  *
135  * @return true if conflicts should not be warned
136  */
137  virtual bool
138  getQuietConflictWarnings() const = 0;
139 
140  /**
141  * If this function returns true, only text nodes can
142  * be copied to the result tree.
143  *
144  * @return true or false
145  */
146  virtual bool
147  getCopyTextNodesOnly() const = 0;
148 
149  /**
150  * Set the flag that determines if only text nodes
151  * can be copied to the result tree.
152  *
153  * @param copyTextNodesOnly The value of the flag
154  */
155  virtual void
156  pushCopyTextNodesOnly(bool copyTextNodesOnly) = 0;
157 
158  /**
159  * Pop the last flag setting that determines if only text nodes
160  * can be copied to the result tree.
161  */
162  virtual bool
163  popCopyTextNodesOnly() = 0;
164 
165  /*
166  * A class to manage setting and restoring the flag
167  * for restricting copying only text nodes to the
168  * result tree
169  */
171  {
172  public:
173 
175  StylesheetExecutionContext& executionContext,
176  bool fValue) :
177  m_executionContext(executionContext)
178  {
179  executionContext.pushCopyTextNodesOnly(fValue);
180  }
181 
183  {
184  m_executionContext.popCopyTextNodesOnly();
185  }
186 
187  private:
188 
189  // Not implemented...
191 
193  operator=(const SetAndRestoreCopyTextNodesOnly&);
194 
195  // Data members...
196  StylesheetExecutionContext& m_executionContext;
197 
198  };
199 
200 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
201  /**
202  * Set the flag that determines if the current attribute should be executed
203  * @param processAttribute the value of the flag
204  */
205  virtual void
206  pushProcessCurrentAttribute(bool processAttribute) = 0;
207 
208  /**
209  * Pops the last flag setting that determines if the current attribute should be executed
210  */
211  virtual bool
212  popProcessCurrentAttribute() = 0;
213 
214  /**
215  * Set the flag that determines if an element's attributes should be skipped
216  *
217  * @param skipAttributes the value of the flag
218  */
219  virtual void
220  pushSkipElementAttributes(bool skipAttributes) = 0;
221 
222  /**
223  * Get the last flag setting that determines if an element's attributes should be skipped
224  * @returns the value of the flag
225  */
226  virtual bool
227  getSkipElementAttributes() const = 0;
228 
229  /**
230  * Pops the last flag setting that determines if an element's attributes should be skipped
231  */
232  virtual bool
233  popSkipElementAttributes() = 0;
234 
235  /**
236  * Set flag that determines if the if test was true
237  *
238  * @param executeIf the value of the flag
239  */
240  virtual void
241  pushExecuteIf(bool executeIf) = 0;
242 
243  /**
244  * Pop the flag that determines if the if test was true
245  *
246  * @param executeIf the value of the flag
247  */
248  virtual bool
249  popExecuteIf() = 0;
250 #endif
251 
252  /**
253  * Retrieve root document for stylesheet. Note that
254  * this does not have to be a XalanDocument -- it can
255  * be any node in a document.
256  *
257  * @return root document
258  */
259  virtual XalanNode*
260  getRootDocument() const = 0;
261 
262  /**
263  * Set root document for stylesheet. Note that
264  * this does not have to be a XalanDocument -- it can
265  * be any node in a document.
266  *
267  * @param theDocument root document
268  */
269  virtual void
270  setRootDocument(XalanNode* theDocument) = 0;
271 
272  /**
273  * Set root stylesheet for stylesheet.
274  *
275  * @param theStylesheet root stylesheet
276  */
277  virtual void
278  setStylesheetRoot(const StylesheetRoot* theStylesheet) = 0;
279 
280  /**
281  * Retrieve the current mode.
282  *
283  * @return QName for mode
284  */
285  virtual const XalanQName*
286  getCurrentMode() const = 0;
287 
288  /**
289  * Set the current mode.
290  *
291  * @param theMode QName for mode
292  */
293  virtual void
294  pushCurrentMode(const XalanQName* theMode) = 0;
295 
296 
297  /**
298  * Pop the current mode
299  */
300  virtual void
301  popCurrentMode() =0;
302 
303  /**
304  * Retrieve the current template
305  *
306  * @return The current template instance or null if there is no current template
307  */
308  virtual const ElemTemplate*
309  getCurrentTemplate() const = 0;
310 
311  /**
312  * Set the current template
313  *
314  * @param theTemplate The current template instance
315  */
316  virtual void
317  pushCurrentTemplate(const ElemTemplate* theTemplate) = 0;
318 
319  virtual void
320  popCurrentTemplate() = 0;
321 
322 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
323  /*
324  * A class to manage pushing and popping the current
325  * template instance.
326  */
327  class PushAndPopCurrentTemplate
328  {
329  public:
330 
331  PushAndPopCurrentTemplate(
332  StylesheetExecutionContext& executionContext,
333  const ElemTemplate* theTemplate) :
334  m_executionContext(executionContext)
335  {
336  executionContext.pushCurrentTemplate(theTemplate);
337  }
338 
339  ~PushAndPopCurrentTemplate()
340  {
341  m_executionContext.popCurrentTemplate();
342  }
343 
344  private:
345 
346  // Data members...
347  StylesheetExecutionContext& m_executionContext;
348  };
349 #endif
350 
351  /**
352  * See if there is an element pending.
353  */
354  virtual bool
355  isElementPending() const = 0;
356 
357  /**
358  * Replace the contents of a pending attribute.
359  *
360  * @param theName name of attribute
361  * @param theNewType type of attribute
362  * @param theNewValue new value of attribute
363  */
364  virtual void
365  replacePendingAttribute(
366  const XalanDOMChar* theName,
367  const XalanDOMChar* theNewType,
368  const XalanDOMChar* theNewValue) = 0;
369 
370  /**
371  * Get the current formatter listener.
372  *
373  * @return pointer to formatter listener
374  */
375  virtual FormatterListener*
376  getFormatterListener() const = 0;
377 
378  /**
379  * Set the current formatter listener.
380  *
381  * @param flistener pointer to new formatter listener
382  */
383  virtual void
384  setFormatterListener(FormatterListener* flistener) = 0;
385 
386  virtual void
387  pushOutputContext(FormatterListener* flistener = 0) = 0;
388 
389  virtual void
390  popOutputContext() = 0;
391 
393  {
394  public:
395 
396  /**
397  * Construct an object to push and pop the current output context.
398  *
399  * @param theExecutionContext a reference to the current execution context
400  * @param theNewListener the new FormatterListener to set.
401  */
403  StylesheetExecutionContext& theExecutionContext,
404  FormatterListener* theNewListener = 0) :
405  m_executionContext(theExecutionContext)
406  {
407  m_executionContext.pushOutputContext(theNewListener);
408  }
409 
411  {
412  m_executionContext.popOutputContext();
413  }
414 
415  private:
416 
417  StylesheetExecutionContext& m_executionContext;
418  };
419 
420  /**
421  * Add a result attribute to the list of pending attributes.
422  *
423  * @param aname name of attribute
424  * @param value value of attribute
425  */
426  virtual void
427  addResultAttribute(
428  const XalanDOMString& aname,
429  const XalanDOMString& value) = 0;
430 
431  /**
432  * Add a result attribute to the list of pending attributes.
433  *
434  * @param aname name of attribute
435  * @param value value of attribute
436  */
437  virtual void
438  addResultAttribute(
439  const XalanDOMString& aname,
440  const XalanDOMChar* value) = 0;
441 
442  /**
443  * Add namespace attributes for a node to the list of pending attributes.
444  *
445  * @param src source node
446  */
447  virtual void
448  copyNamespaceAttributes(const XalanNode& src) = 0;
449 
450  /**
451  * Retrieve the result prefix corresponding to a namespace.
452  *
453  * @param theNamespace namespace for prefix
454  *
455  * @return A pointer to a string containing the prefix, or 0 if the namespace is not mapped.
456  */
457  virtual const XalanDOMString*
458  getResultPrefixForNamespace(const XalanDOMString& theNamespace) const = 0;
459 
460  /**
461  * Retrieve the result namespace corresponding to a prefix.
462  *
463  * @param thePrefix prefix for namespace
464  *
465  * @return A pointer to a string containing the namespace, or 0 if the prefix is not mapped.
466  */
467  virtual const XalanDOMString*
468  getResultNamespaceForPrefix(const XalanDOMString& thePrefix) const = 0;
469 
470  /**
471  * Determine whether or not a prefix is in use on the pending element or
472  * the pending attributes.
473  *
474  * @param thePrefix prefix for namespace
475  *
476  * @return true if the prefix is in use, false if not.
477  */
478  virtual bool
479  isPendingResultPrefix(const XalanDOMString& thePrefix) = 0;
480 
481 
482  /**
483  * Generate a random namespace prefix guaranteed to be unique.
484  *
485  * @param theValue A string for returning the new prefix
486  */
487  virtual void
488  getUniqueNamespaceValue(XalanDOMString& theValue) const = 0;
489 
490  /**
491  * Retrieve the current number of spaces to indent.
492  *
493  * @return number of spaces
494  */
495  virtual int
496  getIndent() const = 0;
497 
498  /**
499  * Set the current number of spaces to indent.
500  *
501  * @param indentAmount The number of spaces to indent. Use -1 for the default amount.
502  */
503  virtual void
504  setIndent(int indentAmount) = 0;
505 
506  /**
507  * Create and initialize an xpath and return it. This is to be used to
508  * create an XPath that is only used during execution.
509  *
510  * @param str string expression for XPath evaluation
511  * @param resolver resolver for namespace resolution
512  * @return pointer to resulting XPath
513  */
514  virtual const XPath*
515  createMatchPattern(
516  const XalanDOMString& str,
517  const PrefixResolver& resolver) = 0;
518 
519  /**
520  * Return the XPath created by createMatchPattern().
521  *
522  * @param xpath The XPath to return.
523  */
524  virtual void
525  returnXPath(const XPath* xpath) = 0;
526 
527  // A helper class to automatically return an XPath instance.
529  {
530  public:
531 
534  const XPath* xpath = 0) :
535  m_context(context),
536  m_xpath(xpath)
537  {
538  }
539 
541  {
542  if (m_xpath != 0)
543  {
544  m_context.returnXPath(m_xpath);
545  }
546  }
547 
548  const XPath*
549  get() const
550  {
551  return m_xpath;
552  }
553 
554  const XPath*
556  {
557  const XPath* const temp = m_xpath;
558 
559  m_xpath = 0;
560 
561  return temp;
562  }
563 
564  void
565  reset(const XPath* xpath)
566  {
567  if (m_xpath != 0)
568  {
569  m_context.returnXPath(m_xpath);
570  }
571 
572  m_xpath = xpath;
573  }
574 
575  private:
576 
577  StylesheetExecutionContext& m_context;
578 
579  const XPath* m_xpath;
580  };
581 
583 
584  /**
585  * Set a list of top level variables in the specified execution context
586  * stylesheet.
587  *
588  * @param topLevelParams list of top level parameters
589  */
590  virtual void
591  pushTopLevelVariables(const ParamVectorType& topLevelParams) = 0;
592 
593  /**
594  * Execute the supplied XPath and and create a
595  * variable in the current context.
596  *
597  * @param str string expression for XPath evaluation
598  * @param contextNode current node in the source tree
599  * @param resolver resolver for namespace resolution
600  * @return a pointer to the XObject result
601  */
602  virtual const XObjectPtr
603  createVariable(
604  const XPath& xpath,
605  XalanNode* contextNode,
606  const PrefixResolver& resolver) = 0;
607 
608 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
609  /**
610  * Create an ResultTreeFragment as a variable and push it
611  * on to the stack with the current context.
612  *
613  * @param templateChild result tree fragment to use.
614  * @param sourceNode source node
615  * @return a pointer to the XObject result
616  */
617  virtual const XObjectPtr
618  createVariable(
619  const ElemTemplateElement& templateChild,
620  XalanNode* sourceNode) = 0;
621 #endif
622 
623  /**
624  * Execute an XPath using the provided expression,
625  * and push the result as a variable in the context of
626  * the supplied element.
627  *
628  * @param name name of variable
629  * @param element element marker for variable
630  * @param str string expression for XPath evaluation
631  * @param contextNode current node in the source tree
632  * @param resolver resolver for namespace resolution
633  * @return nothing
634  */
635  virtual void
636  pushVariable(
637  const XalanQName& name,
638  const ElemTemplateElement* element,
639  const XalanDOMString& str,
640  XalanNode* contextNode,
641  const PrefixResolver& resolver) = 0;
642 
643  /**
644  * Execute the supplied XPath and push the result as a
645  * variable in the current context.
646  *
647  * @param name name of variable
648  * @param element element marker for variable
649  * @param str string expression for XPath evaluation
650  * @param contextNode current node in the source tree
651  * @param resolver resolver for namespace resolution
652  * @return nothing
653  */
654  virtual void
655  pushVariable(
656  const XalanQName& name,
657  const ElemTemplateElement* element,
658  const XPath& xpath,
659  XalanNode* contextNode,
660  const PrefixResolver& resolver) = 0;
661 
662 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
663  /**
664  * Create an ResultTreeFragment as a variable and push it
665  * on to the stack with the current context.
666  *
667  * @param name name of variable
668  * @param element element marker for variable
669  * @param templateChild result tree fragment to use.
670  * @param sourceNode source node
671  */
672  virtual void
673  pushVariable(
674  const XalanQName& name,
675  const ElemTemplateElement* element,
676  const ElemTemplateElement& templateChild,
677  XalanNode* sourceNode) = 0;
678 #endif
679 
680  /**
681  * Push a named variable onto the variables stack.
682  * The variable has already been evaluated.
683  *
684  * @param name name of variable
685  * @param val pointer to XObject value
686  * @param element element marker for variable
687  */
688  virtual void
689  pushVariable(
690  const XalanQName& name,
691  const XObjectPtr val,
692  const ElemTemplateElement* element) = 0;
693 
694  /**
695  * Push a named variable onto the processor variable stack
696  * The variable will be evaluated when first referenced.
697  *
698  * @param name name of variable
699  * @param var pointer to ElemVariable instance
700  * @param element element marker for variable
701  */
702  virtual void
703  pushVariable(
704  const XalanQName& name,
705  const ElemVariable* var,
706  const ElemTemplateElement* element) = 0;
707 
708  /**
709  * Push a context marker onto the stack to let us know when to stop
710  * searching for a var.
711  */
712  virtual void
713  pushContextMarker() = 0;
714 
715  /**
716  * Pop the current context from the current context stack.
717  */
718  virtual void
719  popContextMarker() = 0;
720 
721 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
722  /*
723  * A class to manage pushing and popping an element's stack
724  * frame context.
725  */
726  class PushAndPopContextMarker
727  {
728  public:
729 
730  PushAndPopContextMarker(StylesheetExecutionContext& executionContext) :
731  m_executionContext(executionContext)
732  {
733  executionContext.pushContextMarker();
734  }
735 
736  PushAndPopContextMarker(
737  StylesheetExecutionContext& executionContext,
738  int& currentStackFrameIndex) :
739  m_executionContext(executionContext)
740  {
741  currentStackFrameIndex = executionContext.getCurrentStackFrameIndex();
742 
743  executionContext.pushContextMarker();
744  }
745 
746  ~PushAndPopContextMarker()
747  {
748  m_executionContext.popContextMarker();
749  }
750 
752  getExecutionContext() const
753  {
754  return m_executionContext;
755  }
756 
757  private:
758 
759  StylesheetExecutionContext& m_executionContext;
760  };
761 #endif
762 
763  /**
764  * Resolve the params that were pushed by the caller.
765  */
766  virtual void
767  resolveTopLevelParams() = 0;
768 
769  /**
770  * Reset the vector of top level parameters.
771  */
772  virtual void
773  clearTopLevelParams() = 0;
774 
775 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
776  class ResolveAndClearTopLevelParams
777  {
778  public:
779 
780  ResolveAndClearTopLevelParams(StylesheetExecutionContext& executionContext) :
781  m_executionContext(executionContext)
782  {
783  m_executionContext.resolveTopLevelParams();
784  }
785 
786  ~ResolveAndClearTopLevelParams()
787  {
788  m_executionContext.clearTopLevelParams();
789  }
790 
791  private:
792 
793  StylesheetExecutionContext& m_executionContext;
794  };
795 
796  /**
797  * Given a template, search for the arguments and push them on the stack.
798  * Also, push default arguments on the stack.
799  *
800  * @param xslCallTemplateElement "call-template" element
801  */
802  virtual void
803  pushParams(const ElemTemplateElement& xslCallTemplateElement) = 0;
804 
805 #else
806 
807  /**
808  * Initiate context to accept a new set of parameters
809  */
810  virtual void beginParams() = 0;
811 
812  /**
813  * Indicate parameter set is complete
814  */
815  virtual void endParams() = 0;
816 
817  /**
818  * Push a single paramter onto the latest initialized paramter set
819  * @param qName the name of the parameter
820  * @param theValue the value of the parameter
821  */
822  virtual void pushParam(const XalanQName& qName,const XObjectPtr& theValue) = 0;
823 #endif
824 
825  /**
826  * Given a name, return a string representing the value, but don't look in
827  * the global space.
828  *
829  * @param theName name of variable
830  * @return An XObjectPtr instance. Call XObjectPtr::null() on the instance
831  * to determine if the variable was found. If XObjectPtr::null()
832  * returns true, the variable was not found, and no other operations
833  * on the XObject instance are permitted.
834  */
835  virtual const XObjectPtr
836  getParamVariable(const XalanQName& theName) = 0;
837 
838  /**
839  * Push a frame marker for an element.
840  *
841  * @param elem the element
842  */
843  virtual void
844  pushElementFrame(const ElemTemplateElement* elem) = 0;
845 
846  /**
847  * Pop a frame marker for an element.
848  *
849  * @param elem the element
850  */
851  virtual void
852  popElementFrame() = 0;
853 
854 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
855  /*
856  * A class to manage pushing and popping an element's stack
857  * frame context.
858  */
859  class PushAndPopElementFrame
860  {
861  public:
862 
863  PushAndPopElementFrame(
864  StylesheetExecutionContext& executionContext,
865  const ElemTemplateElement* element) :
866  m_executionContext(executionContext)
867  {
868  executionContext.pushElementFrame(element);
869  }
870 
871  ~PushAndPopElementFrame()
872  {
873  m_executionContext.popElementFrame();
874  }
875 
876  private:
877 
878  StylesheetExecutionContext& m_executionContext;
879  };
880 #endif
881 
882  /**
883  * Get the top of the global stack frame.
884  *
885  * @return current value of index
886  */
887  virtual int
888  getGlobalStackFrameIndex() const = 0;
889 
890  /**
891  * Get the top of the stack frame from where a search
892  * for a variable or param should take place.
893  *
894  * @return current value of index
895  */
896  virtual int
897  getCurrentStackFrameIndex() const = 0;
898 
899  /**
900  * Set the top of the stack frame from where a search
901  * for a variable or param should take place.
902  *
903  * @param currentStackFrameIndex new value of index
904  */
905  virtual void
906  pushCurrentStackFrameIndex(int currentStackFrameIndex = -1) = 0;
907 
908  /**
909  * Pop the last stack frame index setting
910  */
911  virtual void
912  popCurrentStackFrameIndex() = 0;
913 
914  /*
915  * A class to manage the state of the variable stacks frame index.
916  */
918  {
919  public:
920 
922  StylesheetExecutionContext& executionContext,
923  int newIndex) :
924  m_executionContext(executionContext),
925  m_savedIndex(executionContext.getCurrentStackFrameIndex())
926  {
927  executionContext.pushCurrentStackFrameIndex(newIndex);
928  }
929 
931  {
932  m_executionContext.popCurrentStackFrameIndex();
933  }
934 
935  private:
936 
937  StylesheetExecutionContext& m_executionContext;
938 
939  const int m_savedIndex;
940  };
941 
942 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
943  /*
944  * A class to manage stack state during execution.
945  */
946  class ParamsPushPop : public PushAndPopContextMarker
947  {
948  public:
949 
950  ParamsPushPop(
951  StylesheetExecutionContext& executionContext,
952  const ElemTemplateElement& xslCallTemplateElement) :
953  PushAndPopContextMarker(executionContext)
954  {
955  doPush(xslCallTemplateElement);
956  }
957 
958  ParamsPushPop(
959  StylesheetExecutionContext& executionContext,
960  const ElemTemplateElement& xslCallTemplateElement,
961  int& savedStackFrameIndex) :
962  PushAndPopContextMarker(executionContext, savedStackFrameIndex)
963  {
964  doPush(
965  xslCallTemplateElement,
966  savedStackFrameIndex);
967  }
968 
969  ~ParamsPushPop()
970  {
971  }
972 
973  private:
974 
975  void
976  doPush(
977  const ElemTemplateElement& xslCallTemplateElement,
978  int stackFrameIndex);
979 
980  void
981  doPush(const ElemTemplateElement& xslCallTemplateElement);
982  };
983 #endif
984 
985  /**
986  * Receive notification of the beginning of a document.
987  *
988  * <p>The SAX parser will invoke this method only once, before any
989  * other methods in this interface or in DTDHandler (except for
990  * setDocumentLocator).</p>
991  *
992  * @exception SAXException
993  */
994  virtual void
995  startDocument() = 0;
996 
997  /**
998  * Receive notification of the end of a document.
999  *
1000  * <p>The SAX parser will invoke this method only once, and it will
1001  * be the last method invoked during the parse. The parser shall
1002  * not invoke this method until it has either abandoned parsing
1003  * (because of an unrecoverable error) or reached the end of
1004  * input.</p>
1005  *
1006  * @exception SAXException
1007  */
1008  virtual void
1009  endDocument() = 0;
1010 
1011  /**
1012  * Receive notification of the beginning of an element.
1013  *
1014  * @param name element type name
1015  */
1016  virtual void
1017  startElement(const XalanDOMChar* name) = 0;
1018 
1019  /**
1020  * Receive notification of the end of an element.
1021  *
1022  * @param name element type name
1023  */
1024  virtual void
1025  endElement(const XalanDOMChar* name) = 0;
1026 
1027  /**
1028  * Receive notification of character data.
1029  *
1030  * @param ch pointer to characters from the XML document
1031  * @param start start position in the array
1032  * @param length number of characters to read from the array
1033  */
1034  virtual void
1035  characters(
1036  const XalanDOMChar* ch,
1037  fl_size_type start,
1038  fl_size_type length) = 0;
1039 
1040  /**
1041  * Receive notification of character data. If available, when the
1042  * disable-output-escaping attribute is used, output raw text without
1043  * escaping.
1044  *
1045  * @param ch pointer to characters from the XML document
1046  * @param start start position in the array
1047  * @param length number of characters to read from the array
1048  */
1049  virtual void
1050  charactersRaw(
1051  const XalanDOMChar* ch,
1052  fl_size_type start,
1053  fl_size_type length) = 0;
1054 
1055  /**
1056  * Called when a Comment is to be constructed.
1057  *
1058  * @param data pointer to comment data
1059  */
1060  virtual void
1061  comment(const XalanDOMChar* data) = 0;
1062 
1063  /**
1064  * Receive notification of a processing instruction.
1065  *
1066  * @param target processing instruction target
1067  * @param data processing instruction data, or null if none was supplied
1068  */
1069  virtual void
1070  processingInstruction(
1071  const XalanDOMChar* target,
1072  const XalanDOMChar* data) = 0;
1073 
1074  /**
1075  * Flush the pending element.
1076  */
1077  virtual void
1078  flushPending() = 0;
1079 
1080  /**
1081  * Clone a node to the result tree
1082  *
1083  * @param node node to clone
1084  * @param locator The Locator, if any
1085  */
1086  virtual void
1087  cloneToResultTree(
1088  const XalanNode& node,
1089  const Locator* locator) = 0;
1090 
1091  /**
1092  * Clone a node to the result tree
1093  *
1094  * @param node node to clone
1095  * @param nodeType the type of the node
1096  * @param overrideStrip false if white space stripping should be done
1097  * @param shouldCloneAttributes true if attributes should be cloned
1098  * @param locator The Locator, if any
1099  */
1100  virtual void
1101  cloneToResultTree(
1102  const XalanNode& node,
1103  XalanNode::NodeType nodeType,
1104  bool overrideStrip,
1105  bool shouldCloneAttributes,
1106  const Locator* locator) = 0;
1107 
1108 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
1109  /**
1110  * Initiate creation of a result tree fragment
1111  * @param sourceNode the source Node
1112  */
1113  virtual void
1114  beginCreateXResultTreeFrag(
1115  XalanNode* sourceNode) = 0;
1116 
1117  /**
1118  * Indicate sthe completion of result tree fragment
1119  * @return a pointer to the result tree fragment
1120  */
1121  virtual const XObjectPtr
1122  endCreateXResultTreeFrag() = 0;
1123 
1124  /**
1125  * Initiate to put execution result in string
1126  *
1127  * @param theResult the string to contain the result
1128  */
1129  virtual void
1130  beginFormatToText(
1131  XalanDOMString& theResult) = 0;
1132 
1133  /**
1134  * Indicates the completion of the result string
1135  *
1136  */
1137  virtual void
1138  endFormatToText() = 0;
1139 #else
1140  /**
1141  * Create an XObject that represents a Result tree fragment.
1142  *
1143  * @param templateChild result tree fragment to use.
1144  * @param sourceNode source node
1145  * @return XObject instance
1146  */
1147  virtual const XObjectPtr
1148  createXResultTreeFrag(
1149  const ElemTemplateElement& templateChild,
1150  XalanNode* sourceNode) = 0;
1151 #endif
1152 
1153  /**
1154  * Output an object to the result tree by doing the right conversions.
1155  * This is public for access by extensions.
1156  *
1157  * @param obj the XObject to output
1158  * @param locator The Locator, if any
1159  */
1160  virtual void
1161  outputToResultTree(
1162  const XObject& xobj,
1163  const Locator* locator) = 0;
1164 
1165  /**
1166  * Given a result tree fragment, walk the tree and
1167  * output it to the result stream.
1168  *
1169  * @param theTree result tree fragment
1170  * @param locator The Locator, if any
1171  */
1172  virtual void
1173  outputResultTreeFragment(
1174  const XObject& theTree,
1175  const Locator* locator) = 0;
1176 
1177  /**
1178  * Determine the full XSLT Namespace URI.
1179  *
1180  * @return Xalan namespace URI
1181  */
1182  virtual const XalanDOMString&
1183  getXSLNameSpaceURL() const = 0;
1184 
1185  /**
1186  * Special Xalan namespace for built-in extensions.
1187  *
1188  * @return Xalan namespace for extensions
1189  */
1190  virtual const XalanDOMString&
1191  getXalanXSLNameSpaceURL() const = 0;
1192 
1193  /**
1194  * Determine if an element is on the recursion stack.
1195  *
1196  * @return true if element on stack
1197  */
1198  virtual bool
1199  findOnElementRecursionStack(const ElemTemplateElement* theElement) const = 0;
1200 
1201  /**
1202  * Push an element onto the recursion stack.
1203  *
1204  * @param theElement pointer to element to push
1205  */
1206  virtual void
1207  pushOnElementRecursionStack(const ElemTemplateElement* theElement) = 0;
1208 
1209  /**
1210  * Pop an element off the recursion stack.
1211  *
1212  * @return pointer to element popped
1213  */
1214  virtual const ElemTemplateElement*
1215  popElementRecursionStack() = 0;
1216 
1217  /**
1218  * Class for keeping track of elements pushed on the element recursion stack
1219  */
1221  {
1222  public:
1223 
1224  /**
1225  * Construct an instance of the recursion stack pusher.
1226  *
1227  * @param executionContext current execution context
1228  * @param element pointer to element to push
1229  */
1231  StylesheetExecutionContext& executionContext,
1232  const ElemTemplateElement* element) :
1233  m_executionContext(executionContext)
1234  {
1235  m_executionContext.pushOnElementRecursionStack(element);
1236  }
1237 
1239  {
1240  m_executionContext.popElementRecursionStack();
1241  }
1242 
1243  private:
1244 
1245  StylesheetExecutionContext& m_executionContext;
1246  };
1247 
1248 
1249  /**
1250  * This is a hook that XResultTreeFrag instances (which are reference
1251  * counted), can notify the owning StylesheetExecutionContext instance
1252  * when they are dereferenced and can be cleaned up.
1253  *
1254  * @param theXResultTreeFrag The instance that is being returned.
1255  *
1256  * @return true if the XResultTreeFrag instance belongs to the execution context. false if not.
1257  */
1258  virtual bool
1259  returnXResultTreeFrag(XResultTreeFrag* theXResultTreeFrag) = 0;
1260 
1261 
1262  enum eDummy
1263  {
1264  eDefaultXMLIndentAmount = 0,
1265  eDefaultHTMLIndentAmount = 0
1266  };
1267 
1268  /**
1269  * Enums to determine whether or not run-time escaping of URLs has been set.
1270  */
1272  {
1273  eEscapeURLsDefault, // Use the value in the stylesheet
1274  eEscapeURLsNo, // Don't escape URLs
1275  eEscapeURLsYes // Escape URLs
1276  };
1277 
1278  /**
1279  * Get the value for run-time escaping of URLs. This can
1280  * override the property specified by the stylesheet. The
1281  * default behavior is to honor the property in the stylesheet.
1282  *
1283  * @return The value of the enum
1284  */
1285  virtual eEscapeURLs
1286  getEscapeURLs() const = 0;
1287 
1288  /**
1289  * Set the value for run-time escaping of URLs. This can
1290  * override the property specified by the stylesheet. The
1291  * default behavior is to honor the property in the stylesheet.
1292  *
1293  * @param value The value of the enum
1294  */
1295  virtual void
1296  setEscapeURLs(eEscapeURLs value) = 0;
1297 
1298 
1299  /**
1300  * Enums to determine whether or not run-time omission of the META tag has been set.
1301  */
1303  {
1304  eOmitMETATagDefault, // Use the value in the stylesheet
1305  eOmitMETATagNo, // Don't omit the META tag
1306  eOmitMETATagYes // Omit the META tag
1307  };
1308 
1309  /**
1310  * Get the value for run-time omission of URLs. This can
1311  * override the property specified by the stylesheet. The
1312  * default behavior is to honor the property in the stylesheet.
1313  *
1314  * @return The value of the enum
1315  */
1316  virtual eOmitMETATag
1317  getOmitMETATag() const = 0;
1318 
1319  /**
1320  * Get the value for run-time omission of URLs. This can
1321  * override the property specified by the stylesheet. The
1322  * default behavior is to honor the property in the stylesheet.
1323  *
1324  * @param value The value of the enum
1325  */
1326  virtual void
1327  setOmitMETATag(eOmitMETATag value) = 0;
1328 
1329  /**
1330  * Create a new FormatterToXML instance. The execution context
1331  * owns the instance and will delete it when reset.
1332  *
1333  * @param writer character output stream to use
1334  * @param version version of the output method
1335  * @param doIndent true if output is to be indented
1336  * @param indent number of spaces to indent at each nesting level
1337  * @param encoding character encoding for the writer
1338  * @param mediaType media type (MIME content type) of the data
1339  * @param doctypeSystem system identifier to be used in the document
1340  * type declaration
1341  * @param doctypePublic public identifier to be used in the document
1342  * type declaration
1343  * @param xmlDecl true if the XSLT processor should output an XML
1344  * declaration
1345  * @param standalone true if the XSLT processor should output a
1346  * standalone document declaration
1347  * @return a pointer to the new instance.
1348  */
1349 
1350  virtual FormatterListener*
1351  createFormatterToXML(
1352  Writer& writer,
1354  bool doIndent = false,
1355  int indent = eDefaultXMLIndentAmount,
1360  bool xmlDecl = true,
1361  const XalanDOMString& standalone = XalanDOMString(XalanMemMgrs::getDummyMemMgr())) = 0;
1362 
1363  /**
1364  * Create a new FormatterToHTML instance. The execution context
1365  * owns the instance and will delete it when reset.
1366  *
1367  * @param writer character output stream to use
1368  * @param encoding character encoding for the writer
1369  * @param mediaType media type (MIME content type) of the data
1370  * @param doctypeSystem system identifier to be used in the document
1371  * type declaration
1372  * @param doctypePublic public identifier to be used in the document
1373  * type declaration
1374  * @param doIndent true if output is to be indented
1375  * @param indent number of spaces to indent at each nesting level
1376  * @param escapeURLs Whether or not to escape URLs according to the recommendation. The default is true.
1377  * @param omitMetaTag Whether or not to output a META TAG according to the recommendation. The default is false.
1378  * @return a pointer to the new instance.
1379  */
1380  virtual FormatterListener*
1381  createFormatterToHTML(
1382  Writer& writer,
1387  bool doIndent = true,
1388  int indent = eDefaultHTMLIndentAmount,
1389  bool escapeURLs = true,
1390  bool omitMetaTag = false) = 0;
1391 
1392  /**
1393  * FormatterToText instance constructor.
1394  *
1395  * @param writer writer for output
1396  * @param encoding character encoding for the writer
1397  */
1398  virtual FormatterListener*
1399  createFormatterToText(
1400  Writer& writer,
1401  const XalanDOMString& encoding) = 0;
1402 
1403 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
1404  class BorrowReturnFormatterToText
1405  {
1406  public:
1407 
1408  BorrowReturnFormatterToText(
1409  StylesheetExecutionContext& executionContext,
1410  Writer& writer,
1411  bool normalizeLinefeed = true,
1412  bool handleIgnorableWhitespace = true);
1413 
1414  ~BorrowReturnFormatterToText()
1415  {
1416  assert(m_formatter != 0);
1417 
1418  m_executionContext.returnFormatterToText(m_formatter);
1419  }
1420 
1422  operator*() const
1423  {
1424  assert(m_formatter != 0);
1425 
1426  return *m_formatter;
1427  }
1428 
1430  get() const
1431  {
1432  assert(m_formatter != 0);
1433 
1434  return m_formatter;
1435  }
1436 
1438  operator->() const
1439  {
1440  return get();
1441  }
1442 
1443  private:
1444 
1445  StylesheetExecutionContext& m_executionContext;
1446 
1447  FormatterToText* m_formatter;
1448  };
1449 
1450 
1451  friend class BorrowReturnFormatterToText;
1452 #endif
1453 
1454 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
1455  /**
1456  * Get node sorter instance
1457  */
1458  virtual NodeSorter*
1459  getNodeSorter() = 0;
1460 
1461 #else
1462  /**
1463  * Borrow a cached NodeSorter instance.
1464  *
1465  * @return A pointer to the instance.
1466  */
1467  virtual NodeSorter*
1468  borrowNodeSorter() = 0;
1469 
1470  /**
1471  * Return a previously borrowed NodeSorter instance.
1472  *
1473  * @param theSorter A pointer the to previously borrowed instance.
1474  * @return true if the instance was previously borrowed, false if not.
1475  */
1476  virtual bool
1477  returnNodeSorter(NodeSorter* theSorter) = 0;
1478 
1479  class BorrowReturnNodeSorter
1480  {
1481  public:
1482 
1483  BorrowReturnNodeSorter(StylesheetExecutionContext& executionContext) :
1484  m_executionContext(executionContext),
1485  m_sorter(executionContext.borrowNodeSorter())
1486  {
1487  assert(m_sorter != 0);
1488  }
1489 
1490  ~BorrowReturnNodeSorter()
1491  {
1492  assert(m_sorter != 0);
1493 
1494  m_executionContext.returnNodeSorter(m_sorter);
1495  }
1496 
1497  NodeSorter&
1498  operator*() const
1499  {
1500  assert(m_sorter != 0);
1501 
1502  return *m_sorter;
1503  }
1504 
1505  NodeSorter*
1506  get() const
1507  {
1508  assert(m_sorter != 0);
1509 
1510  return m_sorter;
1511  }
1512 
1513  NodeSorter*
1514  operator->() const
1515  {
1516  return get();
1517  }
1518 
1519  private:
1520 
1521  StylesheetExecutionContext& m_executionContext;
1522 
1523  NodeSorter* m_sorter;
1524  };
1525 #endif
1526 
1528 
1529  /**
1530  * Create a new XalanNumberFormat instance.
1531  *
1532  * @return an XalanNumberFormatAutoPtr that owns a new
1533  * XalanNumberFormat instance.
1534  */
1535  virtual XalanNumberFormatAutoPtr
1536  createXalanNumberFormat() = 0;
1537 
1538 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
1539  /*
1540  * A class to manage the attribute sets that have been executed
1541  * by an element
1542  */
1544  {
1546  attributeSetNameIndex(0),
1547  matchingAttributeSetIndex(0) {}
1548 
1551 
1552 
1553  };
1554 
1555  virtual void
1556  createUseAttributeSetIndexesOnStack() = 0;
1557 
1558  virtual UseAttributeSetIndexes&
1559  getUseAttributeSetIndexes() = 0;
1560 
1561  virtual void
1562  popUseAttributeSetIndexesFromStack() = 0;
1563 
1564  /**
1565  * Push the element that will invoke
1566  * non children elements (i.e templates, attribute-sets)
1567  *
1568  * @param invokers the element that will invoke non children elements
1569  */
1570  virtual void
1571  pushInvoker(const ElemTemplateElement * invoker) = 0;
1572 
1573  /**
1574  * Pop the element that invoked non children elements
1575  */
1576  virtual void
1577  popInvoker() = 0;
1578 
1579  /**
1580  * Get the lastest element that has invoked
1581  * a non-child element
1582  */
1583  virtual const ElemTemplateElement*
1584  getInvoker() const = 0;
1585 #endif
1586 
1587  /**
1588  * Determine the number of trace listeners.
1589  *
1590  * @return number of listeners
1591  */
1592  virtual tl_size_type
1593  getTraceListeners() const = 0;
1594 
1595  /**
1596  * Fire a generate event.
1597  *
1598  * @param ge generate event to fire
1599  */
1600  virtual void
1601  fireGenerateEvent(const GenerateEvent& ge) = 0;
1602 
1603  /**
1604  * Fire a trace event.
1605  *
1606  * @param te trace event to fire
1607  */
1608  virtual void
1609  fireTraceEvent(const TracerEvent& te) = 0;
1610 
1611  /**
1612  * Fire a selection event.
1613  *
1614  * @param se selection event to fire
1615  */
1616  virtual void
1617  fireSelectEvent(const SelectionEvent& se) = 0;
1618 
1619  /**
1620  * If this is set to true, simple traces of template calls are made.
1621  *
1622  * @return true if traces made
1623  */
1624  virtual bool
1625  getTraceSelects() const = 0;
1626 
1627  /**
1628  * Compose a diagnostic trace of the current selection
1629  *
1630  * @param theStylesheetElement The executing stylesheet element
1631  * @param nl The list of selected nodes
1632  * @param xpath A pointer to the XPath which generated the list of nodes, if any.
1633  */
1634  virtual void
1635  traceSelect(
1636  const ElemTemplateElement& theStylesheetElement,
1637  const NodeRefListBase& nl,
1638  const XPath* xpath) = 0;
1639 
1640  /**
1641  * Compare two strings using the collation of the
1642  * current locale.
1643  *
1644  * @param theLHS a string to compare
1645  * @param theRHS a string to compare
1646  * @param theCaseOrder the case order for the comparison
1647  * @return < 0 if theLHS is before theRHS, 0 if they are equal, or > 0 if theLHS is after theRHS
1648  */
1649  virtual int
1651  const XalanDOMString& theLHS,
1652  const XalanDOMString& theRHS,
1654 
1655  /**
1656  * Compare two strings using the collation of the
1657  * supplied locale.
1658  *
1659  * @param theLHS a string to compare
1660  * @param theRHS a string to compare
1661  * @param theLocal a string that specifies the locale
1662  * @param theCaseOrder the case order for the comparison
1663  * @return < 0 if theLHS is before theRHS, 0 if they are equal, or > 0 if theLHS is after theRHS
1664  */
1665  virtual int
1667  const XalanDOMString& theLHS,
1668  const XalanDOMString& theRHS,
1669  const XalanDOMString& theLocale,
1671 
1672  /**
1673  * Compare two strings using the collation of the
1674  * current locale.
1675  *
1676  * @param theLHS a string to compare
1677  * @param theRHS a string to compare
1678  * @param theCaseOrder the case order for the comparison
1679  * @return < 0 if theLHS is before theRHS, 0 if they are equal, or > 0 if theLHS is after theRHS
1680  */
1681  virtual int
1683  const XalanDOMChar* theLHS,
1684  const XalanDOMChar* theRHS,
1686 
1687  /**
1688  * Compare two strings using the collation of the
1689  * current locale.
1690  *
1691  * @param theLHS a string to compare
1692  * @param theRHS a string to compare
1693  * @param theLocal a string that specifies the locale
1694  * @param theCaseOrder the case order for the comparison
1695  * @return < 0 if theLHS is before theRHS, 0 if they are equal, or > 0 if theLHS is after theRHS
1696  */
1697  virtual int
1699  const XalanDOMChar* theLHS,
1700  const XalanDOMChar* theRHS,
1701  const XalanDOMChar* theLocale,
1703 
1704  /**
1705  * Create a PrintWriter for the provided stream.
1706  *
1707  * @param theTextOutputStream The output stream for the PrintWriter.
1708  * @return The new instance.
1709  */
1710  virtual PrintWriter*
1711  createPrintWriter(XalanOutputStream* theTextOutputStream) = 0;
1712 
1713  /**
1714  * Create a PrintWriter. Create an appropriate output stream
1715  * using the provided file name and encoding.
1716  *
1717  * @param theFileName The file name for the output stream
1718  * @param theEncoding The encoding for the output stream
1719  * @return The new instance.
1720  */
1721  virtual PrintWriter*
1722  createPrintWriter(
1723  const XalanDOMString& theFileName,
1724  const XalanDOMString& theEncoding) = 0;
1725 
1726  /**
1727  * Create a PrintWriter using the provided ostream instance.
1728  *
1729  * @param theStream The output stream for the PrintWriter.
1730  * @return The new instance.
1731  */
1732  virtual PrintWriter*
1733  createPrintWriter(StreamType& theStream) = 0;
1734 
1735  /**
1736  * Create a PrintWriter using the provided FILE instance.
1737  *
1738  * @param theStream The output stream for the PrintWriter.
1739  * @return The new instance.
1740  */
1741  virtual PrintWriter*
1742  createPrintWriter(FILE* theStream) = 0;
1743 
1744  /**
1745  * Get the counters table, which is a table of cached
1746  * results that is used by ElemNumber.
1747  *
1748  * @return A reference to the counters table.
1749  */
1750  virtual CountersTable&
1751  getCountersTable() = 0;
1752 
1753  /**
1754  * Send character data from a node to the result tree.
1755  *
1756  * @param node The node to send.
1757  */
1758  virtual void
1759  characters(const XalanNode& node) = 0;
1760 
1761  /**
1762  * Send character data from an XObject to the result tree.
1763  *
1764  * @param node The xobject to send.
1765  */
1766  virtual void
1767  characters(const XObjectPtr& xobject) = 0;
1768 
1769  /**
1770  * Send raw character data from a node to the result tree.
1771  *
1772  * @param node The node to send.
1773  * @param length number of characters to read from the array
1774  */
1775  virtual void
1776  charactersRaw(const XalanNode& node) = 0;
1777 
1778  /**
1779  * Send raw character data from an XObject to the result tree.
1780  *
1781  * @param node The xobject to send.
1782  */
1783  virtual void
1784  charactersRaw(const XObjectPtr& xobject) = 0;
1785 
1786 
1787  // These interfaces are inherited from XPathExecutionContext...
1788 
1789  virtual void
1790  reset() = 0;
1791 
1792  virtual XalanNode*
1793  getCurrentNode() const = 0;
1794 
1795  virtual void
1796  pushCurrentNode(XalanNode* theCurrentNode) = 0;
1797 
1798  virtual void
1799  popCurrentNode() = 0;
1800 
1801  virtual bool
1802  isNodeAfter(
1803  const XalanNode& node1,
1804  const XalanNode& node2) const = 0;
1805 
1806  virtual void
1807  pushContextNodeList(const NodeRefListBase& theList) = 0;
1808 
1809  virtual void
1810  popContextNodeList() = 0;
1811 
1812  virtual const NodeRefListBase&
1813  getContextNodeList() const = 0;
1814 
1815  virtual size_type
1816  getContextNodeListLength() const = 0;
1817 
1818  virtual size_type
1819  getContextNodeListPosition(const XalanNode& contextNode) const = 0;
1820 
1821  /**
1822  * Determine if an external element is available.
1823  *
1824  * @param theQName The QName of the element
1825  *
1826  * @return whether the given element is available or not
1827  */
1828  virtual bool
1829  elementAvailable(const XalanQName& theQName) const = 0;
1830 
1831  /**
1832  * Determine if an external element is available by resolving
1833  * a string to a QName.
1834  *
1835  * @param theName The name of the element
1836  * @param locator A Locator instance for error reporting
1837  *
1838  * @return whether the given element is available or not
1839  */
1840  virtual bool
1841  elementAvailable(
1842  const XalanDOMString& theName,
1843  const Locator* locator) const = 0;
1844 
1845  /**
1846  * Determine if a function is available.
1847  *
1848  * @param theQName The QName of the function
1849  *
1850  * @return whether the function is available or not
1851  */
1852  virtual bool
1853  functionAvailable(const XalanQName& theQName) const = 0;
1854 
1855  /**
1856  * Determine if a function is available.
1857  *
1858  * @param theName The name of the function
1859  * @param locator A Locator instance for error reporting
1860  *
1861  * @return whether the function is available or not
1862  */
1863  virtual bool
1864  functionAvailable(
1865  const XalanDOMString& theName,
1866  const Locator* locator) const = 0;
1867 
1868  virtual const XObjectPtr
1869  extFunction(
1870  const XalanDOMString& theNamespace,
1871  const XalanDOMString& functionName,
1872  XalanNode* context,
1873  const XObjectArgVectorType& argVec,
1874  const Locator* locator) = 0;
1875 
1876  virtual XalanDocument*
1877  parseXML(
1878  MemoryManager& theManager,
1879  const XalanDOMString& urlString,
1880  const XalanDOMString& base,
1881  ErrorHandler* theErrorHandler = 0) const = 0;
1882 
1883  virtual MutableNodeRefList*
1884  borrowMutableNodeRefList() = 0;
1885 
1886  virtual bool
1887  returnMutableNodeRefList(MutableNodeRefList* theList) = 0;
1888 
1889  virtual MutableNodeRefList*
1890  createMutableNodeRefList(MemoryManager& theManager) const = 0;
1891 
1892 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
1893 
1894  virtual MutableNodeRefList&
1895  createAndPushMutableNodeRefList() = 0;
1896 
1897  virtual void
1898  releaseAndPopMutableNodeRefList() = 0;
1899 
1900  virtual void
1901  pushXObjectPtr(const XObjectPtr& xobjectPtr) = 0;
1902 
1903  virtual void
1904  popXObjectPtr() = 0;
1905 
1906  virtual void
1907  createAndPushNodesToTransformList(const NodeRefListBase* nodeList) = 0;
1908 
1909  virtual XalanNode*
1910  getNextNodeToTransform() = 0;
1911 
1912  virtual void
1913  popNodesToTransformList() = 0;
1914 
1915  /**
1916  * Get a string that is cached on a stack
1917  * @returns a cached string
1918  */
1919  virtual XalanDOMString&
1920  getAndPushCachedString() = 0;
1921 
1922  /**
1923  * Gets the last string that was cached on the stack
1924  * @returns the last string to be cached
1925  */
1926  virtual XalanDOMString&
1927  getLastCachedString() = 0;
1928 
1929  /**
1930  * Gets the last string to be cached on the stack and
1931  * pops it from the stack. The reference is valid until
1932  * the next request is made for a cached string
1933  *
1934  * @returns the last string to be cached
1935  */
1936  virtual XalanDOMString&
1937  getAndPopCachedString() = 0;
1938 #endif
1939 
1940  virtual XalanDOMString&
1941  getCachedString() = 0;
1942 
1943  virtual bool
1944  releaseCachedString(XalanDOMString& theString) = 0;
1945 
1946 
1947  virtual void
1948  getNodeSetByKey(
1949  XalanNode* context,
1950  const XalanQName& qname,
1951  const XalanDOMString& ref,
1952  const Locator* locator,
1953  MutableNodeRefList& nodelist) = 0;
1954 
1955  virtual void
1956  getNodeSetByKey(
1957  XalanNode* context,
1958  const XalanDOMString& name,
1959  const XalanDOMString& ref,
1960  const Locator* locator,
1961  MutableNodeRefList& nodelist) = 0;
1962 
1963  virtual const XObjectPtr
1964  getVariable(
1965  const XalanQName& name,
1966  const Locator* locator = 0) = 0;
1967 
1968  virtual const PrefixResolver*
1969  getPrefixResolver() const = 0;
1970 
1971  virtual void
1972  setPrefixResolver(const PrefixResolver* thePrefixResolver) = 0;
1973 
1974  virtual const XalanDOMString*
1975  getNamespaceForPrefix(const XalanDOMString& prefix) const = 0;
1976 
1977  virtual const XalanDOMString&
1978  findURIFromDoc(const XalanDocument* owner) const = 0;
1979 
1980  virtual const XalanDOMString&
1981  getUnparsedEntityURI(
1982  const XalanDOMString& theName,
1983  const XalanDocument& theDocument) const = 0;
1984 
1985  virtual bool
1986  shouldStripSourceNode(const XalanText& node) = 0;
1987 
1988  virtual XalanDocument*
1989  getSourceDocument(const XalanDOMString& theURI) const = 0;
1990 
1991  virtual void
1992  setSourceDocument(
1993  const XalanDOMString& theURI,
1994  XalanDocument* theDocument) = 0;
1995 
1996  virtual void
1997  formatNumber(
1998  double number,
1999  const XalanDOMString& pattern,
2000  XalanDOMString& theResult,
2001  const XalanNode* context = 0,
2002  const Locator* locator = 0) = 0;
2003 
2004  virtual void
2005  formatNumber(
2006  double number,
2007  const XalanDOMString& pattern,
2008  const XalanDOMString& dfsName,
2009  XalanDOMString& theResult,
2010  const XalanNode* context = 0,
2011  const Locator* locator = 0) = 0;
2012 
2013  // These interfaces are inherited from ExecutionContext...
2014 
2015  virtual void
2016  problem(
2017  eSource source,
2018  eClassification classification,
2019  const XalanDOMString& msg,
2020  const Locator* locator,
2021  const XalanNode* sourceNode) = 0;
2022 
2023  virtual void
2024  problem(
2025  eSource source,
2026  eClassification classification,
2027  const XalanDOMString& msg,
2028  const XalanNode* sourceNode) = 0;
2029 
2030 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
2031 protected:
2032  /**
2033  * Borrow a cached FormatterToText instance.
2034  *
2035  * @return A pointer to the instance.
2036  */
2037  virtual FormatterToText*
2038  borrowFormatterToText() = 0;
2039 
2040  /**
2041  * Return a previously borrowed FormatterToText instance.
2042  *
2043  * @param theFormatter A pointer the to previously borrowed instance.
2044  * @return true if the instance was previously borrowed, false if not.
2045  */
2046  virtual bool
2047  returnFormatterToText(FormatterToText* theFormatter) = 0;
2048 #endif
2049 };
2050 
2051 
2052 
2053 XALAN_CPP_NAMESPACE_END
2054 
2055 
2056 
2057 #endif // STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680
SetAndRestoreCopyTextNodesOnly(StylesheetExecutionContext &executionContext, bool fValue)
Local implementation of MutableNodeRefList.
XPathGuard(StylesheetExecutionContext &context, const XPath *xpath=0)
ElementRecursionStackPusher(StylesheetExecutionContext &executionContext, const ElemTemplateElement *element)
Construct an instance of the recursion stack pusher.
XalanVector< TopLevelArg > ParamVectorType
virtual void pushCurrentTemplate(const ElemTemplate *theTemplate)=0
Set the current template.
<meta name="usage" content="internal"> This is a table of counters, keyed by ElemNumber objects...
virtual void pushCopyTextNodesOnly(bool copyTextNodesOnly)=0
Set the flag that determines if only text nodes can be copied to the result tree. ...
virtual void pushElementFrame(const ElemTemplateElement *elem)=0
Push a frame marker for an element.
XalanMemMgrAutoPtr< XalanNumberFormat > XalanNumberFormatAutoPtr
This acts as the stylesheet root of the stylesheet tree, and holds values that are shared by all styl...
virtual int getCurrentStackFrameIndex() const =0
Get the top of the stack frame from where a search for a variable or param should take place...
Class to hold XObjectPtr return types.
Definition: XObject.hpp:883
Definition: XPath.hpp:64
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...
Class for keeping track of elements pushed on the element recursion stack.
SetAndRestoreCurrentStackFrameIndex(StylesheetExecutionContext &executionContext, int newIndex)
Local implementation of NodeRefList.
A SAX-based formatter interface for the XSL processor.
static MemoryManager & getDummyMemMgr()
OutputContextPushPop(StylesheetExecutionContext &theExecutionContext, FormatterListener *theNewListener=0)
Construct an object to push and pop the current output context.
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
eEscapeURLs
Enums to determine whether or not run-time escaping of URLs has been set.
This class defines an interface for classes that resolve namespace prefixes to their URIs...
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
virtual void pushContextMarker()=0
Push a context marker onto the stack to let us know when to stop searching for a var.
virtual void pushCurrentStackFrameIndex(int currentStackFrameIndex=-1)=0
Set the top of the stack frame from where a search for a variable or param should take place...
#define XALAN_XSLT_EXPORT
NodeRefListBase::size_type size_type
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...
This class represents the base stylesheet or an "import" stylesheet.
Definition: Stylesheet.hpp:86
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

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