Xalan-C++ API Reference 1.12.0
StylesheetExecutionContextDefault.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(STYLESHEETEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680)
19#define STYLESHEETEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
20
21
22
23// Base class include file.
25
26
27
28#include <ctime>
29#include <memory>
30
31
32
38
39
41
42
43#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
45#endif
46
47
48
50
51
52
54
55
56
57#if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
59#endif
62
63
64
72
73
74
75namespace XALAN_CPP_NAMESPACE {
76
77
78
79class XalanSourceTreeDocument;
80class XPathProcessor;
81class XSLTEngineImpl;
82
85//
86// An class which provides support for executing stylesheets.
87//
89{
90public:
91
92 typedef std::clock_t ClockType;
93
97
99 typedef std::pair<const XPath*, ClockType> XPathCacheEntry;
102
105
106 /**
107 * Construct a StylesheetExecutionContextDefault object
108 *
109 * @param theXPathEnvSupport XPath environment support class instance
110 * @param theDOMSupport DOMSupport class instance
111 * @param theXobjectFactory factory class instance for XObjects
112 * @param theCurrentNode current node in the source tree
113 * @param theContextNodeList node list for current context
114 * @param thePrefixResolver pointer to prefix resolver to use
115 */
117 MemoryManager& theManager,
125
126 /**
127 * Construct a StylesheetExecutionContextDefault object
128 *
129 * @param theXPathEnvSupport XPath environment support class instance
130 * @param theDOMSupport DOMSupport class instance
131 * @param theXobjectFactory factory class instance for XObjects
132 * @param theCurrentNode current node in the source tree
133 * @param theContextNodeList node list for current context
134 * @param thePrefixResolver pointer to prefix resolver to use
135 */
136 explicit
138 MemoryManager& theManager,
142
145 MemoryManager& theManager,
149
150 virtual
152
153
154 /**
155 * Set the XPathEnvSupport instance.
156 *
157 * @param theSupport a reference to the instance to use.
158 */
159 void
161 {
162 m_xpathExecutionContextDefault.setXPathEnvSupport(theSupport);
163 }
164
165 /**
166 * Set the DOMSupport instance.
167 *
168 * @param theDOMSupport a reference to the instance to use.
169 */
170 void
172 {
173 m_xpathExecutionContextDefault.setDOMSupport(theDOMSupport);
174 }
175
176 /**
177 * Set the XObjectFactory instance.
178 *
179 * @param theFactory a reference to the instance to use.
180 */
181 void
183 {
184 m_xpathExecutionContextDefault.setXObjectFactory(theXObjectFactory);
185
186 m_xobjectFactory = theXObjectFactory;
187 }
188
189
190 /**
191 * Set the DOMSupport instance.
192 *
193 * @param theDOMSupport a reference to the instance to use.
194 */
195 void
197 {
198 m_xsltProcessor = theProcessor;
199 }
200
201 bool
203 {
204 return m_usePerInstanceDocumentFactory;
205 }
206
207 void
209 {
210 m_usePerInstanceDocumentFactory = fValue;
211 }
212
213
214 // These interfaces are inherited from StylesheetExecutionContext...
215
216 virtual bool
218
219 virtual bool
221
222 virtual void
224
225 virtual bool
227
228#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
229 virtual void
230 pushProcessCurrentAttribute(bool processAttribute);
231
232 virtual bool
234
235 virtual void
237
238 virtual bool
240
241 virtual bool
243
244 virtual void
246
247 virtual bool
249#endif
250
251 virtual XalanNode*
253
254 virtual void
256
257 virtual void
259
260 virtual const XalanQName*
262
263 virtual void
265
266 virtual void
268
269 virtual const ElemTemplate*
271
272 virtual void
274
275 virtual void
277
278 virtual bool
280
281 virtual void
283 const XalanDOMChar* theName,
286
287 virtual void
289
290 virtual void
292
293 virtual void
295 const XalanDOMString& aname,
296 const XalanDOMString& value);
297
298 virtual void
300 const XalanDOMString& aname,
301 const XalanDOMChar* value);
302
303 virtual void
305
306 virtual const XalanDOMString*
308
309 virtual const XalanDOMString*
311
312 virtual bool
314
315 virtual void
317
318 virtual FormatterListener*
320
321 virtual void
323
324 virtual int
325 getIndent() const;
326
327 virtual void
329
330 virtual const XPath*
332 const XalanDOMString& str,
333 const PrefixResolver& resolver);
334
335 virtual void
337
338 virtual void
340
341
342 virtual const XObjectPtr
344 const XPath& xpath,
346 const PrefixResolver& resolver);
347
348#if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
349 virtual const XObjectPtr
350 createVariable(
353#endif
354
355 virtual void
357 const XalanQName& name,
359 const XalanDOMString& str,
361 const PrefixResolver& resolver);
362
363 virtual void
365 const XalanQName& name,
366 const XObjectPtr val,
368
369 virtual void
371 const XalanQName& name,
372 const ElemVariable* var,
374
375 virtual void
377 const XalanQName& name,
379 const XPath& xpath,
381 const PrefixResolver& resolver);
382
383#if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
384 virtual void
385 pushVariable(
386 const XalanQName& name,
390#endif
391
392
393 virtual void
395
396 virtual void
398
399 virtual void
401
402 virtual void
404
405#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
406 virtual void beginParams();
407
408 virtual void endParams();
409
410 virtual void pushParam(const XalanQName& qName,const XObjectPtr& theValue);
411#else
412 virtual void
414#endif
415
416 virtual const XObjectPtr
418
419 virtual void
421
422 virtual void
424
425 virtual int
427
428 virtual int
430
431 virtual void
433
434 virtual void
436
437 virtual void
439
440 virtual void
442
443 virtual void
445
446 virtual void
448
449 virtual void
451 const XalanDOMChar* ch,
452 fl_size_type start,
453 fl_size_type length);
454
455 virtual void
457 const XalanDOMChar* ch,
458 fl_size_type start,
459 fl_size_type length);
460
461 virtual void
462 comment(const XalanDOMChar* data);
463
464 virtual void
466 const XalanDOMChar* target,
467 const XalanDOMChar* data);
468
469 virtual void
471
472 virtual void
474 const XalanNode& node,
475 const Locator* locator);
476
477 virtual void
479 const XalanNode& node,
481 bool overrideStrip,
483 const Locator* locator);
484
485#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
486 virtual void
488
489 virtual const XObjectPtr
491
492 virtual void
494
495 virtual void
497#endif
498
499
500#if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
501 virtual const XObjectPtr
505#endif
506
507 virtual void
509 const XObject& xobj,
510 const Locator* locator);
511
512 virtual void
514 const XObject& theTree,
515 const Locator* locator);
516
517 virtual const XalanDOMString&
519
520 virtual const XalanDOMString&
522
523 virtual bool
525
526 virtual void
528
529 virtual const ElemTemplateElement*
531
532 virtual bool
534
535 virtual eEscapeURLs
537
538 virtual void
540
541 virtual eOmitMETATag
543
544 void
546
547 virtual FormatterListener*
549 Writer& writer,
550 const XalanDOMString& version = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
551 bool doIndent = false,
552 int indent = eDefaultXMLIndentAmount,
553 const XalanDOMString& encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
554 const XalanDOMString& mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
555 const XalanDOMString& doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
556 const XalanDOMString& doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
557 bool xmlDecl = true,
558 const XalanDOMString& standalone = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
559
560 virtual FormatterListener*
562 Writer& writer,
563 const XalanDOMString& encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
564 const XalanDOMString& mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
565 const XalanDOMString& doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
566 const XalanDOMString& doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
567 bool doIndent = true,
568 int indent = eDefaultHTMLIndentAmount,
569 bool escapeURLs = true,
570 bool omitMetaTag = false);
571
572 virtual FormatterListener*
574 Writer& writer,
575 const XalanDOMString& encoding);
576
577#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
578 virtual NodeSorter*
580#else
581 virtual NodeSorter*
583
584 virtual bool
586#endif
587
590
591 // A basic class to create XalanNumberFormat instances...
593 {
594 public:
595
596 explicit
598
599 virtual
601
602 virtual XalanNumberFormat*
603 create(MemoryManager& theManager);
604 };
605
608 {
609 return s_defaultXalanNumberFormatFactory;
610 }
611
612 /**
613 * Static function to install a new XalanNumberFormatFactory.
614 * The caller owns the XalanNumberFormatFactory instance.
615 *
616 * @param a pointer to the new factory instance to use.
617 * @return a pointer to the old factory instance.
618 */
619 static XalanNumberFormatFactory*
621
622
623 virtual tl_size_type
625
626 virtual void
628
629 virtual void
631
632 virtual void
634
635 virtual bool
637
638 virtual void
641 const NodeRefListBase& nl,
642 const XPath* xpath);
643
644 virtual int
646 const XalanDOMString& theLHS,
647 const XalanDOMString& theRHS,
648 XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault);
649
650 virtual int
652 const XalanDOMString& theLHS,
653 const XalanDOMString& theRHS,
655 XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault);
656
657 virtual int
659 const XalanDOMChar* theLHS,
660 const XalanDOMChar* theRHS,
661 XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault);
662
663 virtual int
665 const XalanDOMChar* theLHS,
666 const XalanDOMChar* theRHS,
667 const XalanDOMChar* theLocale,
668 XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault);
669
671
673 {
674 public:
675
677
678 virtual
680
681 virtual int
683 const XalanDOMChar* theLHS,
684 const XalanDOMChar* theRHS,
685 XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault) const;
686
687 virtual int
689 const XalanDOMChar* theLHS,
690 const XalanDOMChar* theRHS,
691 const XalanDOMChar* theLocale,
692 XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault) const;
693 };
694
695
698
701
702
704 {
705 public:
706
708
709 virtual
711
712 virtual void
715 double theNumber,
719 const XalanNode* context = 0,
720 const Locator* locator = 0) const = 0;
721 };
722
723 virtual void
725 double number,
726 const XalanDOMString& pattern,
728 const XalanNode* context = 0,
729 const Locator* locator = 0);
730
731 virtual void
733 double number,
734 const XalanDOMString& pattern,
735 const XalanDOMString& dfsName,
737 const XalanNode* context = 0,
738 const Locator* locator = 0);
739
740
741 const FormatNumberFunctor*
743
746
747 virtual PrintWriter*
749
750 virtual PrintWriter*
754
755 virtual PrintWriter*
757
758 virtual PrintWriter*
760
761 virtual CountersTable&
763
764 virtual void
765 characters(const XalanNode& node);
766
767 virtual void
769
770 virtual void
772
773 virtual void
775
776
777 // These interfaces are inherited from XPathExecutionContext...
778
779 virtual void
781
782 virtual XalanNode*
784
785 virtual void
787
788 virtual void
790
791 virtual bool
793 const XalanNode& node1,
794 const XalanNode& node2) const;
795
796 virtual void
798
799 virtual void
801
802 virtual const NodeRefListBase&
804
805 virtual size_type
807
808 virtual size_type
810
811 virtual bool
813
814 virtual bool
816 const XalanDOMString& theName,
817 const Locator* locator) const;
818
819 virtual bool
821
822 virtual bool
824 const XalanDOMString& theName,
825 const Locator* locator) const;
826
827 virtual const XObjectPtr
830 const XalanDOMString& functionName,
833 const Locator* locator);
834
835 virtual XalanDocument*
837 MemoryManager& theManager,
839 const XalanDOMString& base,
840 ErrorHandler* theErrorHandler = 0) const;
841
842 virtual MutableNodeRefList*
844
845 virtual bool
847
848 virtual MutableNodeRefList*
850
851#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
852 virtual void
854
857
858 virtual void
860
861 virtual void
863
864 virtual void
866
867 virtual const ElemTemplateElement*
868 getInvoker() const;
869
870 virtual MutableNodeRefList&
872
873 virtual void
875
876 virtual void
878
879 virtual void
881
882 virtual void
884
885 virtual XalanNode*
887
888 virtual void
890
891 virtual XalanDOMString&
893
894 virtual XalanDOMString&
896
897 virtual XalanDOMString&
899#endif
900
901 virtual XalanDOMString&
903
904 virtual bool
906
907
908 virtual void
911 const XalanQName& qname,
912 const XalanDOMString& ref,
913 const Locator* locator,
915
916 virtual void
919 const XalanDOMString& name,
920 const XalanDOMString& ref,
921 const Locator* locator,
923
924 virtual const XObjectPtr
926 const XalanQName& name,
927 const Locator* locator = 0);
928
929 virtual const PrefixResolver*
931
932 virtual void
934
935 virtual const XalanDOMString*
937
938 virtual const XalanDOMString&
940
941 virtual const XalanDOMString&
943 const XalanDOMString& theName,
944 const XalanDocument& theDocument) const;
945
946 virtual bool
948
949 virtual XalanDocument*
951
952 virtual void
954 const XalanDOMString& theURI,
956
957 // These interfaces are inherited from ExecutionContext...
958 virtual void
960 eSource source,
962 const XalanDOMString& msg,
963 const Locator* locator,
964 const XalanNode* sourceNode);
965
966 virtual void
968 eSource source,
970 const XalanDOMString& msg,
971 const XalanNode* sourceNode);
972
974 {
975 public:
976
981
982 void
984
985 private:
986
987 XSLTEngineImpl& m_xsltProcessor;
988 };
989
990 /**
991 * Get a XalanSourceTreeDocument, primarily for creating result
992 * tree fragments.
993 */
995 getSourceTreeFactory(MemoryManager& theManager) const;
996
997#if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
998protected:
999
1000 virtual FormatterToText*
1002
1003 virtual bool
1005#endif
1006
1007private:
1008
1010 getDecimalFormatSymbols(const XalanQName& qname);
1011
1012#if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
1013 /**
1014 * Given a context, create the params for a template
1015 * call.
1016 *
1017 * @param xslCallTemplateElement "call-template" element
1018 * @param params The params
1019 */
1020 void
1021 getParams(
1024#endif
1025
1026 /**
1027 * Determine if the XPath is one that we have cached.
1028 *
1029 * @param theXPath the XPath instance to check
1030 * @return true if the instance has been cached, false if not.
1031 */
1032 bool
1033 isCached(const XPath* theXPath);
1034
1035 /**
1036 * Clear out the cache of XPath instances.
1037 */
1038 void
1039 clearXPathCache();
1040
1041 /**
1042 * Add an XPath instance to the cache, clearing out an old entry
1043 * if the cache is full.
1044 *
1045 * @param pattern the key for looking up the XPath instance in the cache.
1046 * @param theXPath the XPath instance to cache
1047 */
1048 void
1049 addToXPathCache(
1050 const XalanDOMString& pattern,
1051 const XPath* theXPath);
1052
1053
1054 /**
1055 * Clean up anything that was created for use only during the transformation.
1056 */
1057 void
1058 cleanUpTransients();
1059
1060 XPathExecutionContextDefault m_xpathExecutionContextDefault;
1061
1062 XSLTEngineImpl* m_xsltProcessor;
1063
1064 XalanNode* m_rootDocument;
1065
1066 enum { eXPathCacheMax = 50,
1067 eDefaultParamsVectorSize = 10,
1068 eXResultTreeFragAllocatorBlockSize = 10,
1069 eDocumentAllocatorBlockSize = 10,
1070 eDocumentFragmentAllocatorBlockSize = 10,
1071 eDefaultAttributeAllocatorBlockSize = 10,
1072 eDefaultAttributeNSAllocatorBlockSize = 10,
1073 eDefaultCommentAllocatorBlockSize = 10,
1074 eDefaultElementAllocatorBlockSize = 10,
1075 eDefaultElementNSAllocatorBlockSize = 10,
1076 eDefaultPIAllocatorBlockSize = 10,
1077 eDefaultTextAllocatorBlockSize = 20,
1078 eDefaultTextIWSAllocatorBlockSize = 20 };
1079
1080 ElementTemplateElementStackType m_elementRecursionStack;
1081
1082 const StylesheetRoot* m_stylesheetRoot;
1083
1084 FormatterListenerVectorType m_formatterListeners;
1085
1086 PrintWriterVectorType m_printWriters;
1087
1088 OutputStreamVectorType m_outputStreams;
1089
1090 CollationCompareFunctor* m_collationCompareFunctor;
1091
1092 FormatNumberFunctor * m_formatNumberFunctor;
1093
1094 /**
1095 * Holds all information about variables during execution.
1096 */
1097 VariablesStack m_variablesStack;
1098
1099 ParamsVectorType m_paramsVector;
1100
1101 XPathCacheMapType m_matchPatternCache;
1102
1103 KeyTablesTableType m_keyTables;
1104
1105 CountersTable m_countersTable;
1106
1107 /**
1108 * The factory that will be used to create result tree fragments based on our
1109 * internal source tree.
1110 */
1111 mutable XalanMemMgrAutoPtr<XalanSourceTreeDocument> m_sourceTreeResultTreeFactory;
1112
1113 // Holds the current mode.
1114 const XalanQName* m_mode;
1115
1116 CurrentTemplateStackType m_currentTemplateStack;
1117
1118 int m_indentAmount;
1119
1120 XResultTreeFragAllocator m_xresultTreeFragAllocator;
1121
1122 XalanSourceTreeDocumentFragmentAllocator m_documentFragmentAllocator;
1123
1124 XalanSourceTreeDocumentAllocator m_documentAllocator;
1125
1126 typedef XalanVector<bool> BooleanStackType;
1127 typedef XalanVector<const XalanQName*> ModeStackType;
1128 typedef XalanVector<int> IntStackType;
1129
1130 BooleanStackType m_copyTextNodesOnlyStack;
1131 ModeStackType m_modeStack;
1132 IntStackType m_currentIndexStack;
1133
1134#if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
1138
1140
1142
1144#else
1145
1146 class FormatterToTextDOMString : public FormatterToText
1147 {
1148 public:
1149
1150 FormatterToTextDOMString(MemoryManager& theManager);
1151
1152 virtual
1153 ~FormatterToTextDOMString();
1154
1155 void
1156 setDOMString(XalanDOMString& theString)
1157 {
1158 m_printWriter.setString(theString);
1159 }
1160
1161 private:
1162
1163 // These are not defined...
1164 FormatterToTextDOMString(const FormatterToTextDOMString&);
1165
1166 FormatterToTextDOMString&
1167 operator=(const FormatterToTextDOMString&);
1168
1169 bool
1170 operator==(const FormatterToTextDOMString&) const;
1171
1172
1173 // Data members...
1174 DOMStringPrintWriter m_printWriter;
1175
1176 static XalanDOMString s_dummyString;
1177 };
1178
1179 typedef XalanVector<XObjectPtr> XObjectPtrStackType;
1180 typedef XalanVector<ParamsVectorType> ParamsVectorStackType;
1181 typedef XalanVector<UseAttributeSetIndexes> UseAttributeSetIndexesStackType;
1182 typedef XalanObjectStackCache<MutableNodeRefList,DefaultCacheCreateFunctorMemMgr<MutableNodeRefList> >
1183 MutableNodeRefListStackType;
1184
1185 typedef XalanObjectStackCache<XalanDOMString,DefaultCacheCreateFunctorMemMgr<XalanDOMString> >
1186 StringStackType;
1187
1188 typedef XalanObjectStackCache<FormatterToTextDOMString,DefaultCacheCreateFunctorMemMgr<FormatterToTextDOMString> >
1189 FormatterToTextStackType;
1190 typedef XalanObjectStackCache<FormatterToSourceTree,DefaultCacheCreateFunctorMemMgr<FormatterToSourceTree> >
1191 FormatterToSourceTreeStackType;
1192
1193 /*
1194 * class to maintain the list of nodes to be transformed by an element
1195 */
1196 class NodesToTransform
1197 {
1198 public:
1199 NodesToTransform(const NodeRefListBase* nodeList) :
1200 m_nodeList(nodeList), m_index(0)
1201 {
1202 assert(m_nodeList != 0);
1203 }
1204
1205 const NodeRefListBase* operator() ()
1206 {
1207 return m_nodeList;
1208 }
1209
1210 NodeRefListBase::size_type& index()
1211 {
1212 return m_index;
1213 }
1214
1215 XalanNode* next()
1216 {
1217 if (m_index < m_nodeList->getLength())
1218 {
1219 return m_nodeList->item(m_index++);
1220 }
1221 return 0;
1222 }
1223
1224 private:
1225 const NodeRefListBase* m_nodeList;
1226 NodeRefListBase::size_type m_index;
1227 };
1228
1229 typedef XalanVector<NodesToTransform> NodesToTransformStackType;
1230
1231 XObjectPtrStackType m_xobjectPtrStack;
1232 MutableNodeRefListStackType m_mutableNodeRefListStack;
1233 NodesToTransformStackType m_nodesToTransformStack;
1234 BooleanStackType m_processCurrentAttributeStack;
1235 BooleanStackType m_executeIfStack;
1236 StringStackType m_stringStack;
1237 FormatterToTextStackType m_formatterToTextStack;
1238 BooleanStackType m_skipElementAttributesStack;
1239 FormatterToSourceTreeStackType m_formatterToSourceTreeStack;
1240 ParamsVectorStackType m_paramsVectorStack;
1241 ElementTemplateElementStackType m_elementInvokerStack;
1242 UseAttributeSetIndexesStackType m_useAttributeSetIndexesStack;
1243
1244 NodeSorter m_nodeSorter;
1245#endif
1246
1247 // If true, we will use a separate document factory for
1248 // result tree fragments.
1249 bool m_usePerInstanceDocumentFactory;
1250
1251 // Determines whether or not to override the property in the stylesheet.
1252 eEscapeURLs m_escapeURLs;
1253
1254 // Determines whether or not to override the property in the stylesheet.
1255 eOmitMETATag m_omitMETATag;
1256
1257 static XalanNumberFormatFactory s_defaultXalanNumberFormatFactory;
1258
1259 static XalanNumberFormatFactory* s_xalanNumberFormatFactory;
1260
1261 static const DefaultCollationCompareFunctor s_defaultCollationFunctor;
1262};
1263
1264
1265
1266}
1267
1268
1269
1270#endif // STYLESHEETEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
#define XALAN_XSLT_EXPORT
#define XALAN_USES_MEMORY_MANAGER(Type)
#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.
virtual int operator()(const XalanDOMChar *theLHS, const XalanDOMChar *theRHS, XalanCollationServices::eCaseOrder theCaseOrder=XalanCollationServices::eDefault) const
virtual int operator()(const XalanDOMChar *theLHS, const XalanDOMChar *theRHS, const XalanDOMChar *theLocale, XalanCollationServices::eCaseOrder theCaseOrder=XalanCollationServices::eDefault) const
void operator()(const XPathCacheMapType::value_type &theCacheEntry)
virtual XalanNumberFormat * create(MemoryManager &theManager)
virtual int getCurrentStackFrameIndex() const
Get the top of the stack frame from where a search for a variable or param should take place.
virtual void pushOutputContext(FormatterListener *flistener=0)
virtual void pushCopyTextNodesOnly(bool copyTextNodesOnly)
Set the flag that determines if only text nodes can be copied to the result tree.
virtual void pushVariable(const XalanQName &name, const ElemVariable *var, const ElemTemplateElement *element)
Push a named variable onto the processor variable stack The variable will be evaluated when first ref...
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
virtual void pushCurrentMode(const XalanQName *theMode)
Set the current mode.
virtual int collationCompare(const XalanDOMString &theLHS, const XalanDOMString &theRHS, XalanCollationServices::eCaseOrder theCaseOrder=XalanCollationServices::eDefault)
Compare two strings using the collation of the current locale.
virtual NodeSorter * getNodeSorter()
Get node sorter instance.
virtual bool releaseCachedString(XalanDOMString &theString)
Return a cached string.
virtual bool returnXResultTreeFrag(XResultTreeFrag *theXResultTreeFrag)
This is a hook that XResultTreeFrag instances (which are reference counted), can notify the owning St...
virtual void endElement(const XalanDOMChar *name)
Receive notification of the end of an element.
virtual XalanNumberFormatAutoPtr createXalanNumberFormat()
Create a new XalanNumberFormat instance.
virtual XalanDocument * getSourceDocument(const XalanDOMString &theURI) const
Get the document associated with the given URI.
virtual void getUniqueNamespaceValue(XalanDOMString &theValue) const
Generate a random namespace prefix guaranteed to be unique.
virtual CountersTable & getCountersTable()
Get the counters table, which is a table of cached results that is used by ElemNumber.
virtual const XObjectPtr extFunction(const XalanDOMString &theNamespace, const XalanDOMString &functionName, XalanNode *context, const XObjectArgVectorType &argVec, const Locator *locator)
Handle an extension function.
virtual bool elementAvailable(const XalanQName &theQName) const
Determine if an external element is available.
static XalanNumberFormatFactory & getDefaultXalanNumberFormatFactory()
XalanVector< const ElemTemplateElement * > ElementTemplateElementStackType
virtual void charactersRaw(const XalanDOMChar *ch, fl_size_type start, fl_size_type length)
Receive notification of character data.
virtual void createAndPushNodesToTransformList(const NodeRefListBase *nodeList)
virtual void popCurrentNode()
Reset the node currently being executed.
virtual const ElemTemplate * getCurrentTemplate() const
Retrieve the current template.
virtual size_type getContextNodeListLength() const
virtual void outputResultTreeFragment(const XObject &theTree, const Locator *locator)
Given a result tree fragment, walk the tree and output it to the result stream.
StylesheetExecutionContextDefault(MemoryManager &theManager, XalanNode *theCurrentNode=0, const NodeRefListBase *theContextNodeList=0, const PrefixResolver *thePrefixResolver=0)
Construct a StylesheetExecutionContextDefault object.
virtual void pushXObjectPtr(const XObjectPtr &xobjectPtr)
virtual bool popSkipElementAttributes()
Pops the last flag setting that determines if an element's attributes should be skipped.
XalanMap< XalanDOMString, XPathCacheEntry > XPathCacheMapType
virtual void formatNumber(double number, const XalanDOMString &pattern, XalanDOMString &theResult, const XalanNode *context=0, const Locator *locator=0)
Formats a number according to the specified pattern.
virtual void pushExecuteIf(bool executeIf)
Set flag that determines if the if test was true.
virtual void beginCreateXResultTreeFrag(XalanNode *sourceNode)
Initiate creation of a result tree fragment.
virtual void setEscapeURLs(eEscapeURLs value)
Set the value for run-time escaping of URLs.
XalanCollationServices::CollationCompareFunctor CollationCompareFunctor
virtual size_type getContextNodeListPosition(const XalanNode &contextNode) const
virtual void fireSelectEvent(const SelectionEvent &se)
Fire a selection event.
CollationCompareFunctor * uninstallCollationCompareFunctor()
virtual void pushContextMarker()
Push a context marker onto the stack to let us know when to stop searching for a var.
virtual bool getCopyTextNodesOnly() const
If this function returns true, only text nodes can be copied to the result tree.
virtual bool functionAvailable(const XalanQName &theQName) const
Determine if a function is available.
StylesheetExecutionContextDefault(MemoryManager &theManager, XSLTEngineImpl &xsltProcessor, XPathEnvSupport &theXPathEnvSupport, DOMSupport &theDOMSupport, XObjectFactory &theXObjectFactory, XalanNode *theCurrentNode=0, const NodeRefListBase *theContextNodeList=0, const PrefixResolver *thePrefixResolver=0)
Construct a StylesheetExecutionContextDefault object.
virtual void reset()
Reset the instance.
virtual tl_size_type getTraceListeners() const
Determine the number of trace listeners.
virtual void popContextMarker()
Pop the current context from the current context stack.
virtual const XalanDOMString & getXalanXSLNameSpaceURL() const
Special Xalan namespace for built-in extensions.
virtual void fireTraceEvent(const TracerEvent &te)
Fire a trace event.
virtual MutableNodeRefList * createMutableNodeRefList(MemoryManager &theManager) const
Create a MutableNodeRefList with the appropriate context.
FormatNumberFunctor * uninstallFormatNumberFunctor()
void setXObjectFactory(XObjectFactory *theXObjectFactory)
Set the XObjectFactory instance.
virtual int collationCompare(const XalanDOMString &theLHS, const XalanDOMString &theRHS, const XalanDOMString &theLocale, XalanCollationServices::eCaseOrder theCaseOrder=XalanCollationServices::eDefault)
Compare two strings using the collation of the supplied locale.
virtual void pushProcessCurrentAttribute(bool processAttribute)
Set the flag that determines if the current attribute should be executed.
virtual void flushPending()
Flush the pending element.
virtual void endFormatToText()
Indicates the completion of the result string.
virtual void beginFormatToText(XalanDOMString &theResult)
Initiate to put execution result in string.
virtual void fireGenerateEvent(const GenerateEvent &ge)
Fire a generate event.
virtual void clearTopLevelParams()
Reset the vector of top level parameters.
virtual bool elementAvailable(const XalanDOMString &theName, const Locator *locator) const
Determine if an external element is available by resolving a string to a QName.
virtual XalanNode * getRootDocument() const
Retrieve root document for stylesheet.
virtual void pushCurrentTemplate(const ElemTemplate *theTemplate)
Set the current template.
virtual MutableNodeRefList * borrowMutableNodeRefList()
Borrow a cached MutableNodeRefList instance.
virtual void pushInvoker(const ElemTemplateElement *invoker)
Push the element that will invoke non children elements (i.e templates, attribute-sets)
virtual void pushParam(const XalanQName &qName, const XObjectPtr &theValue)
Push a single paramter onto the latest initialized paramter set.
virtual XalanNode * getNextNodeToTransform()
virtual PrintWriter * createPrintWriter(StreamType &theStream)
Create a PrintWriter using the provided ostream instance.
virtual XalanDOMString & getAndPopCachedString()
Gets the last string to be cached on the stack and pops it from the stack.
virtual void pushTopLevelVariables(const ParamVectorType &topLevelParams)
Set a list of top level variables in the specified execution context stylesheet.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const Locator *locator, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
virtual void pushOnElementRecursionStack(const ElemTemplateElement *theElement)
Push an element onto the recursion stack.
virtual void endDocument()
Receive notification of the end of a document.
virtual XalanNode * getCurrentNode() const
Retrieve the node currently being executed.
virtual XalanDOMString & getCachedString()
Get a cached string for temporary use.
virtual void pushCurrentStackFrameIndex(int currentStackFrameIndex=-1)
Set the top of the stack frame from where a search for a variable or param should take place.
void setXSLTProcessor(XSLTEngineImpl *theProcessor)
Set the DOMSupport instance.
virtual eOmitMETATag getOmitMETATag() const
Get the value for run-time omission of URLs.
virtual void addResultAttribute(const XalanDOMString &aname, const XalanDOMString &value)
Add a result attribute to the list of pending attributes.
virtual void startElement(const XalanDOMChar *name)
Receive notification of the beginning of an element.
void setOmitMETATag(eOmitMETATag value)
Get the value for run-time omission of URLs.
virtual void processingInstruction(const XalanDOMChar *target, const XalanDOMChar *data)
Receive notification of a processing instruction.
void setXPathEnvSupport(XPathEnvSupport *theSupport)
Set the XPathEnvSupport instance.
virtual UseAttributeSetIndexes & getUseAttributeSetIndexes()
virtual PrintWriter * createPrintWriter(const XalanDOMString &theFileName, const XalanDOMString &theEncoding)
Create a PrintWriter.
virtual void comment(const XalanDOMChar *data)
Called when a Comment is to be constructed.
virtual void outputToResultTree(const XObject &xobj, const Locator *locator)
Output an object to the result tree by doing the right conversions.
virtual void getNodeSetByKey(XalanNode *context, const XalanDOMString &name, const XalanDOMString &ref, const Locator *locator, MutableNodeRefList &nodelist)
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)
Execute an XPath using the provided expression, and push the result as a variable in the context of t...
virtual PrintWriter * createPrintWriter(FILE *theStream)
Create a PrintWriter using the provided FILE instance.
virtual void beginParams()
Initiate context to accept a new set of parameters.
virtual bool returnMutableNodeRefList(MutableNodeRefList *theList)
Return a previously borrowed MutableNodeRefList instance.
virtual bool isPendingResultPrefix(const XalanDOMString &thePrefix)
Determine whether or not a prefix is in use on the pending element or the pending attributes.
virtual bool getQuietConflictWarnings() const
Determine whether conflicts should be reported.
virtual FormatterListener * createFormatterToText(Writer &writer, const XalanDOMString &encoding)
FormatterToText instance constructor.
virtual XalanDOMString & getAndPushCachedString()
Get a string that is cached on a stack.
virtual void addResultAttribute(const XalanDOMString &aname, const XalanDOMChar *value)
Add a result attribute to the list of pending attributes.
virtual bool isElementPending() const
See if there is an element pending.
virtual const XObjectPtr getVariable(const XalanQName &name, const Locator *locator=0)
Given a name, locate a variable in the current context, and return a pointer to the object.
virtual void popContextNodeList()
Pop the node list for current context.
virtual void getNodeSetByKey(XalanNode *context, const XalanQName &qname, const XalanDOMString &ref, const Locator *locator, MutableNodeRefList &nodelist)
Given a valid element key, return the corresponding node list.
virtual void pushElementFrame(const ElemTemplateElement *elem)
Push a frame marker for an element.
virtual int collationCompare(const XalanDOMChar *theLHS, const XalanDOMChar *theRHS, const XalanDOMChar *theLocale, XalanCollationServices::eCaseOrder theCaseOrder=XalanCollationServices::eDefault)
Compare two strings using the collation of the current locale.
virtual void cloneToResultTree(const XalanNode &node, const Locator *locator)
Clone a node to the result tree.
virtual void setIndent(int indentAmount)
Set the current number of spaces to indent.
static StylesheetExecutionContextDefault * create(MemoryManager &theManager, XalanNode *theCurrentNode=0, const NodeRefListBase *theContextNodeList=0, const PrefixResolver *thePrefixResolver=0)
virtual void formatNumber(double number, const XalanDOMString &pattern, const XalanDOMString &dfsName, XalanDOMString &theResult, const XalanNode *context=0, const Locator *locator=0)
Formats a number according to the specified pattern.
virtual void setStylesheetRoot(const StylesheetRoot *theStylesheet)
Set root stylesheet for stylesheet.
virtual const NodeRefListBase & getContextNodeList() const
Get the node list for current context.
virtual eEscapeURLs getEscapeURLs() const
Get the value for run-time escaping of URLs.
virtual const ElemTemplateElement * popElementRecursionStack()
Pop an element off the recursion stack.
virtual bool getTraceSelects() const
If this is set to true, simple traces of template calls are made.
virtual void returnXPath(const XPath *xpath)
Return the XPath created by createMatchPattern().
virtual bool popExecuteIf()
Pop the flag that determines if the if test was true.
const FormatNumberFunctor * installFormatNumberFunctor(FormatNumberFunctor *formatNumberFunctor)
virtual const XalanDOMString * getResultPrefixForNamespace(const XalanDOMString &theNamespace) const
Retrieve the result prefix corresponding to a namespace.
virtual bool isNodeAfter(const XalanNode &node1, const XalanNode &node2) const
Determine if a node is after another node, in document order.
virtual bool popCopyTextNodesOnly()
Pop the last flag setting that determines if only text nodes can be copied to the result tree.
virtual void setSourceDocument(const XalanDOMString &theURI, XalanDocument *theDocument)
Associate a document with a given URI.
virtual void charactersRaw(const XalanNode &node)
Send raw character data from a node to the result tree.
virtual int getIndent() const
Retrieve the current number of spaces to indent.
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)
Create a new FormatterToHTML instance.
virtual XalanDocument * parseXML(MemoryManager &theManager, const XalanDOMString &urlString, const XalanDOMString &base, ErrorHandler *theErrorHandler=0) const
Provides support for XML parsing service.
virtual const ElemTemplateElement * getInvoker() const
Get the lastest element that has invoked a non-child element.
virtual void popCurrentMode()
Pop the current mode.
virtual void endParams()
Indicate parameter set is complete.
const CollationCompareFunctor * installCollationCompareFunctor(CollationCompareFunctor *theFunctor)
virtual void popCurrentStackFrameIndex()
Pop the last stack frame index setting.
virtual void pushCurrentNode(XalanNode *theCurrentNode)
Change the node currently being executed.
virtual const XObjectPtr getParamVariable(const XalanQName &theName)
Given a name, return a string representing the value, but don't look in the global space.
virtual bool findOnElementRecursionStack(const ElemTemplateElement *theElement) const
Determine if an element is on the recursion stack.
virtual int getGlobalStackFrameIndex() const
Get the top of the global stack frame.
virtual const PrefixResolver * getPrefixResolver() const
Retrieve the resolver for namespaces.
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()))
Create a new FormatterToXML instance.
virtual bool getSkipElementAttributes() const
Get the last flag setting that determines if an element's attributes should be skipped.
virtual void setPrefixResolver(const PrefixResolver *thePrefixResolver)
Change the resolver for namespaces.
virtual void pushSkipElementAttributes(bool skipAttributes)
Set the flag that determines if an element's attributes should be skipped.
virtual void cloneToResultTree(const XalanNode &node, XalanNode::NodeType nodeType, bool overrideStrip, bool shouldCloneAttributes, const Locator *locator)
Clone a node to the result tree.
virtual void setRootDocument(XalanNode *theDocument)
Set root document for stylesheet.
virtual void popInvoker()
Pop the element that invoked non children elements.
virtual const XPath * createMatchPattern(const XalanDOMString &str, const PrefixResolver &resolver)
Create and initialize an xpath and return it.
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve the URI corresponding to a namespace prefix.
void setDOMSupport(DOMSupport *theDOMSupport)
Set the DOMSupport instance.
virtual const XalanDOMString & getXSLNameSpaceURL() const
Determine the full XSLT Namespace URI.
virtual void charactersRaw(const XObjectPtr &xobject)
Send raw character data from an XObject to the result tree.
virtual void characters(const XalanNode &node)
Send character data from a node to the result tree.
virtual void pushContextNodeList(const NodeRefListBase &theList)
Push the node list for current context.
virtual void replacePendingAttribute(const XalanDOMChar *theName, const XalanDOMChar *theNewType, const XalanDOMChar *theNewValue)
Replace the contents of a pending attribute.
virtual XalanDOMString & getLastCachedString()
Gets the last string that was cached on the stack.
virtual bool functionAvailable(const XalanDOMString &theName, const Locator *locator) const
Determine if a function is available.
virtual FormatterListener * getFormatterListener() const
Get the current formatter listener.
virtual bool popProcessCurrentAttribute()
Pops the last flag setting that determines if the current attribute should be executed.
virtual void resolveTopLevelParams()
Resolve the params that were pushed by the caller.
virtual const XObjectPtr createVariable(const XPath &xpath, XalanNode *contextNode, const PrefixResolver &resolver)
Execute the supplied XPath and and create a variable in the current context.
virtual void pushVariable(const XalanQName &name, const ElemTemplateElement *element, const XPath &xpath, XalanNode *contextNode, const PrefixResolver &resolver)
Execute the supplied XPath and push the result as a variable in the current context.
virtual const XalanDOMString & findURIFromDoc(const XalanDocument *owner) const
Given a DOM Document, tell what URI was used to parse it.
virtual void copyNamespaceAttributes(const XalanNode &src)
Add namespace attributes for a node to the list of pending attributes.
virtual void characters(const XalanDOMChar *ch, fl_size_type start, fl_size_type length)
Receive notification of character data.
static XalanNumberFormatFactory * installXalanNumberFormatFactory(XalanNumberFormatFactory *theFactory)
Static function to install a new XalanNumberFormatFactory.
virtual PrintWriter * createPrintWriter(XalanOutputStream *theTextOutputStream)
Create a PrintWriter for the provided stream.
virtual void traceSelect(const ElemTemplateElement &theStylesheetElement, const NodeRefListBase &nl, const XPath *xpath)
Compose a diagnostic trace of the current selection.
virtual void characters(const XObjectPtr &xobject)
Send character data from an XObject to the result tree.
XalanSourceTreeDocument * getSourceTreeFactory(MemoryManager &theManager) const
Get a XalanSourceTreeDocument, primarily for creating result tree fragments.
virtual void pushVariable(const XalanQName &name, const XObjectPtr val, const ElemTemplateElement *element)
Push a named variable onto the variables stack.
virtual void setFormatterListener(FormatterListener *flistener)
Set the current formatter listener.
virtual const XObjectPtr endCreateXResultTreeFrag()
Indicate sthe completion of result tree fragment.
virtual const XalanDOMString * getResultNamespaceForPrefix(const XalanDOMString &thePrefix) const
Retrieve the result namespace corresponding to a prefix.
virtual const XalanQName * getCurrentMode() const
Retrieve the current mode.
virtual bool shouldStripSourceNode(const XalanText &node)
Determine if a text node should be stripped from the source tree, as if it weren't there.
virtual MutableNodeRefList & createAndPushMutableNodeRefList()
virtual const XalanDOMString & getUnparsedEntityURI(const XalanDOMString &theName, const XalanDocument &theDocument) const
The getUnparsedEntityURI function returns the URI of the unparsed entity with the specified name in t...
virtual int collationCompare(const XalanDOMChar *theLHS, const XalanDOMChar *theRHS, XalanCollationServices::eCaseOrder theCaseOrder=XalanCollationServices::eDefault)
Compare two strings using the collation of the current locale.
virtual void popElementFrame()
Pop a frame marker for an element.
virtual void startDocument()
Receive notification of the beginning of a document.
eEscapeURLs
Enums to determine whether or not run-time escaping of URLs has been set.
eOmitMETATag
Enums to determine whether or not run-time omission of the META tag has been set.
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.
Defines a class to keep track of a stack for macro arguments.
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
A basic implementation of the class XPathExecutionContext.
It's the responsibility of the XSLTEngineImpl class, collaborating with the XML parser liaison,...
std::pair< const key_type, data_type > value_type
Definition XalanMap.hpp:201
Class to represent a qualified name.
size_t size_type
Definition XalanMap.hpp:46