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