Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


ElemTemplateElement.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(XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD)
19 #define XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
30 
31 
32 
36 
37 
38 
40 
41 
42 
44 
45 
46 
47 #include "LocalMsgIndex.hpp"
48 
49 
50 
51 XALAN_DECLARE_XERCES_CLASS(AttributeList)
52 XALAN_DECLARE_XERCES_CLASS(Locator)
53 
54 
55 
56 XALAN_CPP_NAMESPACE_BEGIN
57 
58 
59 
60 typedef XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType;
61 typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType;
62 
63 
64 XALAN_USING_XERCES(AttributeList)
65 XALAN_USING_XERCES(Locator)
66 class ElemTemplate;
67 class ElemTextLiteral;
68 class NamespacesHandler;
69 class Stylesheet;
72 class XPath;
73 
74 
75 
77 {
78 
79 public:
80 
81  /**
82  * Construct a template element instance.
83  *
84  * @param constructionContext context when object constructed
85  * @param stylesheetTree owning stylesheet
86  * @param lineNumber line in the XSLT file where the element occurs
87  * @param columnNumber column index in the XSLT file where the
88  * element occurs
89  * @param xslToken an integer representing the type of instance.
90  */
92  StylesheetConstructionContext& constructionContext,
93  Stylesheet& stylesheetTree,
94  XalanFileLoc lineNumber,
95  XalanFileLoc columnNumber,
96  int xslToken);
97 
98  /**
99  * Special constructor used by dummy elements which do not exist in the
100  * final stylesheet.
101  *
102  * @param constructionContext context when object constructed
103  * @param stylesheetTree owning stylesheet
104  * @param baseURI The base URI of the XSLT file where the element occurs.
105  * @param lineNumber line in the XSLT file where the element occurs
106  * @param columnNumber column index in the XSLT file where the
107  * element occurs
108  * @param xslToken an integer representing the type of instance.
109  */
111  StylesheetConstructionContext& constructionContext,
112  Stylesheet& stylesheetTree,
113  int xslToken,
115  XalanFileLoc lineNumber = XalanLocator::getUnknownValue(),
116  XalanFileLoc columnNumber = XalanLocator::getUnknownValue());
117 
118  virtual
120 
121  /**
122  * Get the Locator for the node. This may return 0.
123  *
124  * @return The Locator for the node.
125  */
126  virtual const Locator*
127  getLocator() const;
128 
129  /**
130  * See if this is a xmlns attribute or in a non-XSLT.
131  *
132  * @param attrName qualified name of attribute
133  * @param atts attribute list where the element comes from (not used at
134  * this time)
135  * @param which index into the attribute list (not used at this time)
136  * @param constructionContext The current construction context
137  * @return true if this is a namespace name
138  */
139  virtual bool
140  isAttrOK(
141  const XalanDOMChar* attrName,
142  const AttributeListType& atts,
143  XalanSize_t which,
144  StylesheetConstructionContext& constructionContext) const;
145 
146  /**
147  * Tell whether or not this is a xml:space attribute and, if so, process it.
148  *
149  * @param elementName name of the element with the attribute
150  * @param aname name of the attribute in question
151  * @param atts attribute list that owns the attribute
152  * @param which index of the attribute into the attribute list
153  * @param constructionContext The current construction context
154  * @return true if this is a xml:space attribute
155  */
156  bool
157  processSpaceAttr(
158  const XalanDOMChar* elementName,
159  const XalanDOMChar* aname,
160  const AttributeListType& atts,
161  XalanSize_t which,
162  StylesheetConstructionContext& constructionContext);
163 
164  /**
165  * Validate that the string is an NCName.
166  *
167  * @param s name in question
168  * @return true if the string is a valid NCName according to XML rules
169  * @see http://www.w3.org/TR/REC-xml-names#NT-NCName
170  */
171  static bool
172  isValidNCName(const XalanDOMString& s);
173 
174 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
175 
176  /**
177  * Completes "pre-processing" before any sub-elements are invoked
178  * (i.e. children, attribute sets and templates). If there are
179  * no sub-elements it executes the primary function of the element.
180  *
181  * @param executionContext context to execute this element
182  */
183  virtual const ElemTemplateElement*
184  startElement(StylesheetExecutionContext& executionContext) const;
185 
186  /**
187  * Completes "post-processing" afer any sub-elements are invoked
188  * (i.e. children, attribute sets and templates). If there are
189  * no sub-elements it does nothing
190  *
191  * @param executionContext context to execute this element
192  */
193  virtual void
194  endElement(StylesheetExecutionContext& executionContext) const;
195 
196  /**
197  * Execute the element.
198  *
199  * @param execute context to execute this element
200  */
201  virtual void
202  execute(StylesheetExecutionContext& executionContext) const;
203 
204  /**
205  * Execute the children of this element.
206  *
207  * @param execute context to execute this element
208  */
209  virtual void
210  executeChildren(StylesheetExecutionContext& executionContext) const;
211 
212  /**
213  * Returns the element that invoked this element.
214  * @returns element that invoked this element.
215  */
216  virtual const ElemTemplateElement*
217  getInvoker(StylesheetExecutionContext& executionContext) const;
218 
219 #else
220 
221  /**
222  * Execute the element's primary function. Subclasses of this function may
223  * recursively execute down the element tree.
224  *
225  * @param executionContext The current execution context
226  */
227  virtual void
228  execute(StylesheetExecutionContext& executionContext) const;
229 
230  /**
231  * Process the children of a template.
232  *
233  * @param processor XSLT processor instance
234  */
235  virtual void
236  executeChildren(StylesheetExecutionContext& executionContext) const;
237 
238  /**
239  * Set the current node and process the children of a template.
240  *
241  * @param processor XSLT processor instance
242  * @param sourceNode current node
243  */
244  virtual void
245  executeChildren(
246  StylesheetExecutionContext& executionContext,
247  XalanNode* sourceNode) const;
248 
249  /**
250  * Take the contents of a template element, process it, and
251  * convert it to a string. Returns a const reference to
252  * the resulting string value. Note that this may _not_ be
253  * the XalanDOMString instance passed in, if an optimization
254  * is available to return a pre-existing string.
255  *
256  * @param executionContext The current execution context
257  * @param result result of executing the elements children
258  * @result a reference to a string containing the result.
259  */
260  const XalanDOMString&
261  childrenToString(
262  StylesheetExecutionContext& executionContext,
263  XalanDOMString& result) const;
264 
265  /**
266  * Take the contents of a template element, process it, and
267  * convert it to a string. Then, add an attribute to the
268  * result tree using the provided name and the string value.
269  *
270  * @param executionContext The current execution context
271  * @param theName The name for the result attribute
272  */
273  void
274  childrenToResultAttribute(
275  StylesheetExecutionContext& executionContext,
276  const XalanDOMString& theName) const;
277 
278  /**
279  * Take the contents of a template element, process it, and
280  * convert it to a string. Then, add a comment to the
281  * result tree using the string value.
282  *
283  * @param executionContext The current execution context
284  */
285  void
286  childrenToResultComment(StylesheetExecutionContext& executionContext) const;
287 
288  /**
289  * Take the contents of a template element, process it, and
290  * convert it to a string. Then, add a processing instruction
291  * to the result tree using the string value, and the provided
292  * target.
293  *
294  * @param executionContext The current execution context
295  * @param theName The name for the result attribute
296  */
297  void
298  childrenToResultPI(
299  StylesheetExecutionContext& executionContext,
300  const XalanDOMString& theTarget) const;
301 
302  /**
303  * Get an integer representation of the element type.
304  *
305  * @return integer representation of the element, defined in the Constants
306  * class
307  * @see class Constants
308  */
309 #endif
310 
311  int
312  getXSLToken() const
313  {
314  return m_xslToken;
315  }
316 
317  /**
318  * Tell if the element will generate text which is XML whitespace.
319  *
320  * @return true if the text is pure whitespace
321  */
322  virtual bool
323  isWhitespace() const;
324 
325  /**
326  * Get a string for the name of the element. Useful for debugging purposes,
327  * and error reporting.
328  *
329  * @return A string containing the name of the element.
330  */
331  virtual const XalanDOMString&
332  getElementName() const = 0;
333 
334  /**
335  * Get the QName associated with any name attribute of this element.
336  * If the element has no name attribute, this will be an empty QName.
337  *
338  * @return A string containing the name of the element.
339  */
340  virtual const XalanQName&
341  getNameAttribute() const;
342 
343  /**
344  * Called during compilation when an instance is not parented by
345  * another element, and thus, is a child of the stylesheet..
346  *
347  * @param constructionContext The current construction context
348  * @param theStylesheet The owning stylesheet
349  * @return nothing
350  */
351  virtual void
352  addToStylesheet(
353  StylesheetConstructionContext& constructionContext,
354  Stylesheet& theStylesheet);
355 
356  /**
357  * Called during compilation to process xsl:sort elements in
358  * the stylesheet.
359  *
360  * @param constructionContext The current construction context
361  * @param theStylesheet The owning stylesheet
362  * @param atts The list of attributes for the sort element
363  * @param locator A Locator instance for error reporting, if available.
364  *
365  * @return nothing
366  */
367  virtual void
368  processSortElement(
369  StylesheetConstructionContext& constructionContext,
370  Stylesheet& theStylesheet,
371  const AttributeListType& atts,
372  const Locator* locator = 0);
373 
374  /**
375  * Sets a flag indicating this is the default template
376  *
377  * @param value The value of flag.
378  */
379  virtual void
380  setDefaultTemplate(bool value);
381 
382  /**
383  * Get the namespaces handler for this element.
384  *
385  * @return The element's NamespacesHandler instance.
386  */
387  const NamespacesHandler&
389  {
390  return m_namespacesHandler;
391  }
392 
393  /**
394  * Retrieve the stylesheet from which this element comes
395  *
396  * @return reference to source stylesheet
397  */
398  const Stylesheet&
400  {
401  return m_stylesheet;
402  }
403 
404  /**
405  * Set the flag indicating construction of the element is completed.
406  *
407  * @param fValue The value to set
408  */
409  void
411  {
412  setFlag(eFinishedConstruction, fValue);
413  }
414 
415  /**
416  * Get the flag indicating construction of the element is completed.
417  */
418  bool
420  {
421  return getFlag(eFinishedConstruction);
422  }
423 
424  /**
425  * Called after construction is completed.
426  */
427  virtual void
428  postConstruction(
429  StylesheetConstructionContext& constructionContext,
430  const NamespacesHandler& theParentHandler);
431 
432  // Type-safe getters/setters...
433 
434  /**
435  * Get the first child.
436  *
437  * @return first child node of this node
438  */
439  virtual ElemTemplateElement*
440  getFirstChildElem() const;
441 
442 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
443  /**
444  * Method to initiate the execution of the element's children.
445  *
446  * @param executionContext context to execute this element
447  * @returns the first child element to execute
448  */
449  virtual const ElemTemplateElement*
450  beginExecuteChildren(
451  StylesheetExecutionContext& executionContext) const;
452 
453 
454  /**
455  * Method to indicate the execution of the element's children
456  * is complete
457  *
458  * @param executionContext context to execute this element
459  */
460  virtual void
461  endExecuteChildren(
462  StylesheetExecutionContext& executionContext) const;
463 
464  /**
465  * Method to initiate output from the children
466  * to a string.
467  *
468  * @param executionContext context to execute this element
469  * @param result string to contain the final result
470  * @returns the first child element to execute
471  */
472  const ElemTemplateElement*
473  beginChildrenToString(
474  StylesheetExecutionContext& executionContext,
475  XalanDOMString& result) const;
476 
477 
478  /**
479  * Method to indicate string output from the children is
480  * complete.
481  *
482  * @param executionContext context to execute this element
483  */
484  void
485  endChildrenToString(
486  StylesheetExecutionContext& executionContext) const;
487 #endif
488 
489 
490  /**
491  * Set the first child.
492  *
493  * theChild - the new value for the first child.
494  *
495  * @return nothing
496  */
497  virtual void
498  setFirstChildElem(ElemTemplateElement* theChild);
499 
500  /**
501  * Get the last child.
502  *
503  * @return last child node of this node
504  */
505  virtual ElemTemplateElement*
506  getLastChildElem() const;
507 
508  /**
509  * Get the next sibling.
510  *
511  * @return next sibling node of this node
512  */
513  virtual ElemTemplateElement*
514  getNextSiblingElem() const;
515 
516 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
517 
518  /**
519  * Returns the next sub-element
520  *(i.e. children, attribute-sets, templates) to execute.
521  *
522  * @param executionContext context to execute element
523  * @param currentElem the last sub-element to be executed
524  * @returns next sub-element to execute, 0 only if no more sub-elements to execute
525  */
526  virtual const ElemTemplateElement*
527  getNextChildElemToExecute(
528  StylesheetExecutionContext& executionContext,
529  const ElemTemplateElement* currentElem) const;
530 
531  /**
532  * Returns the first sub-element
533  *(i.e. children, attribute-sets, templates) to execute.
534  *
535  * @param executionContext context to execute element
536  * @returns first sub-element to execute, 0 only if no sub-elements to execute
537  */
538  virtual const ElemTemplateElement*
539  getFirstChildElemToExecute(
540  StylesheetExecutionContext& executionContext) const;
541 
542  /**
543  * Filters sub-elements that should be executed
544  *
545  * @param executionContext context to execute element
546  * @param element the element to be executed
547  * @returns true if element should be executed, false otherwise
548  */
549  virtual bool executeChildElement(
550  StylesheetExecutionContext& executionContext,
551  const ElemTemplateElement* element) const;
552 #endif
553 
554  /**
555  * Set the next sibling.
556  *
557  * theSibling - the new value for the next sibling.
558  *
559  * @return nothing
560  */
561  virtual void
562  setNextSiblingElem(ElemTemplateElement* theSibling);
563 
564  /**
565  * Get the previous sibling.
566  *
567  * @return previous sibling node of this node
568  */
569  virtual ElemTemplateElement*
570  getPreviousSiblingElem() const;
571 
572  /**
573  * Set the previous sibling.
574  *
575  * theSibling - the new value for the previous sibling.
576  *
577  * @return nothing
578  */
579  virtual void
580  setPreviousSiblingElem(ElemTemplateElement* theSibling);
581 
582  /**
583  * Get the parent node.
584  *
585  * @return parent node of this node
586  */
587  virtual ElemTemplateElement*
588  getParentNodeElem() const;
589 
590  /**
591  * Set the parent node.
592  *
593  * theParent - the new value for the parent.
594  *
595  * @return nothing
596  */
597  virtual void
598  setParentNodeElem(ElemTemplateElement* theParent);
599 
600  /**
601  * Append a child.
602  *
603  * theParent - the new value for the parent.
604  *
605  * @return nothing
606  */
607  virtual ElemTemplateElement*
608  appendChildElem(ElemTemplateElement* newChild);
609 
610  /**
611  * Get XPath pattern/expression of one of the element atribute
612  *
613  * @index number of the attribute. If an attribute has more
614  * then one attribute with pattern/expression,the order of
615  * the returned expressions are undefined
616  *
617  * @return pointer or null
618  */
619  virtual const XPath*
620  getXPath(XalanSize_t index) const;
621 
622  // These interfaces are inherited from PrefixResolver...
623 
624  virtual const XalanDOMString*
625  getNamespaceForPrefix(const XalanDOMString& prefix) const;
626 
627  virtual const XalanDOMString&
628  getURI() const;
629 
630  // A class that implements the XalanLocator
631  // abstract base class. ElemTemplateElement
632  // uses this class to provide locator information.
633  class LocatorProxy : public XalanLocator
634  {
635  public:
636 
637  LocatorProxy(
638  XalanFileLoc theLineNumber,
639  XalanFileLoc theColumnNumber,
640  const XalanDOMString& theURI);
641 
642  virtual
643  ~LocatorProxy();
644 
645  virtual const XMLCh*
646  getPublicId() const;
647 
648  virtual const XMLCh*
649  getSystemId() const;
650 
651  virtual XalanFileLoc
652  getLineNumber() const;
653 
654  virtual XalanFileLoc
655  getColumnNumber() const;
656 
657  const XalanDOMString&
658  getURI() const
659  {
660  return m_uri;
661  }
662 
663  private:
664 
665  // Not implemented...
666  LocatorProxy(const LocatorProxy&);
667 
668  LocatorProxy&
669  operator=(const LocatorProxy&);
670 
671  bool
672  operator==(const LocatorProxy&) const;
673 
674  // data members...
675  const XalanFileLoc m_lineNumber;
676 
677  const XalanFileLoc m_columnNumber;
678 
679  const XalanDOMString& m_uri;
680  };
681 
682 
683  XalanFileLoc
685  {
686  return m_locatorProxy.getLineNumber();
687  }
688 
689  XalanFileLoc
691  {
692  return m_locatorProxy.getColumnNumber();
693  }
694 
695  bool
696  hasParams() const
697  {
698  return getFlag(eHasParams);
699  }
700 
701  bool
702  hasVariables() const
703  {
704  return getFlag(eHasVariables);
705  }
706 
707  bool
709  {
710  return getFlag(eHasSingleTextChild);
711  }
712 
713  bool
714  hasChildren() const
715  {
716  return m_firstChild != 0 ? true : false;
717  }
718 
719  bool
721  {
722  return getFlag(eHasDirectTemplate);
723  }
724 
725  bool
727  {
728  return getFlag(eCanGenerateAttributes);
729  }
730 
731  bool
733  {
734  return getFlag(eDefaultTemplate);
735  }
736 
737 protected:
738 
739  void
741  {
742  setFlag(eCanGenerateAttributes, value);
743  }
744 
745  void
746  hasPrefix(bool value)
747  {
748  setFlag(eHasPrefix, value);
749  }
750 
751  bool
752  hasPrefix() const
753  {
754  return getFlag(eHasPrefix);
755  }
756 
757  void
758  preserveSpace(bool value)
759  {
760  setFlag(eSpacePreserve, value);
761  }
762 
763  bool
765  {
766  return getFlag(eSpacePreserve);
767  }
768 
769  void
771  {
772  setFlag(eDisableOutputEscaping, value);
773  }
774 
775  bool
777  {
778  return getFlag(eDisableOutputEscaping);
779  }
780 
781  /**
782  * Process the exclude-result-prefixes or the extension-element-prefixes
783  * attributes, for the purpose of prefix exclusion.
784  *
785  * @param constructionContext context when object consructed
786  * @param stylesheetTree The current Stylesheet object.
787  * @param localName The local name of the attribute.
788  * @param attrValue The value of the attribute.
789  */
790  bool
791  processPrefixControl(
792  StylesheetConstructionContext& constructionContext,
793  const Stylesheet& stylesheetTree,
794  const XalanDOMString& localName,
795  const XalanDOMChar* attrValue);
796 
797  /**
798  * Get the namespace for a given prefix.
799  *
800  * @param prefix The prefix to search for
801  * @param fExists If not null, set to true if the namespace was defined.
802  * @return The namespace string.
803  */
804  const XalanDOMString*
805  getNamespaceForPrefixInternal(const XalanDOMString& prefix) const;
806 
807 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
808  /**
809  * Given an element, find the corresponding
810  * template.
811  *
812  * @param executionContext The current execution context
813  * @param xslInstruction The calling element
814  * @param template The template to use if xsl:for-each, or null.
815  * @param child The source context node.
816  * @returns matching template if any. Returns 0 if no matching template or corresponds to a default rule.
817  */
818  virtual const ElemTemplateElement*
819  findTemplateToTransformChild(
820  StylesheetExecutionContext& executionContext,
821  const ElemTemplateElement& xslInstruction,
822  const ElemTemplateElement* theTemplate,
823  XalanNode* child) const;
824 
825  /**
826  * Given an element, find the corresponding
827  * template.
828  *
829  * @param executionContext The current execution context
830  * @param xslInstruction The calling element
831  * @param template The template to use if xsl:for-each, or null.
832  * @param child The source context node.
833  * @param nodeType The type of child.
834  * @returns matching template if any. Returns 0 if no matching template or corresponds to a default rule.
835  */
836  virtual const ElemTemplateElement*
837  findTemplateToTransformChild(
838  StylesheetExecutionContext& executionContext,
839  const ElemTemplateElement& xslInstruction,
840  const ElemTemplateElement* theTemplate,
841  XalanNode* child,
842  XalanNode::NodeType nodeType) const;
843 #else
844  /**
845  * Given an element, find the corresponding
846  * template and process the contents.
847  *
848  * @param executionContext The current execution context
849  * @param xslInstruction The calling element
850  * @param template The template to use if xsl:for-each, or null.
851  * @param child The source context node.
852  */
853  virtual void
854  transformChild(
855  StylesheetExecutionContext& executionContext,
856  const ElemTemplateElement& xslInstruction,
857  const ElemTemplateElement* theTemplate,
858  XalanNode* child) const;
859 
860  /**
861  * Given an element, find the corresponding
862  * template and process the contents.
863  *
864  * @param executionContext The current execution context
865  * @param xslInstruction The calling element
866  * @param template The template to use if xsl:for-each, or null.
867  * @param child The source context node.
868  * @param nodeType The type of child.
869  */
870  virtual void
871  transformChild(
872  StylesheetExecutionContext& executionContext,
873  const ElemTemplateElement& xslInstruction,
874  const ElemTemplateElement* theTemplate,
875  XalanNode* child,
876  XalanNode::NodeType nodeType) const;
877 #endif
878 
879  /**
880  * Given an xsl token type, determine whether or not a child
881  * of that type is allowed. This is so derived types can
882  * determine whether a particular type of child is allowed for
883  * the instance. It is called from appendChildElem().
884  *
885  * The default is to allow no types (no children)
886  *
887  * @param xslToken The xsl token value of the child.
888  *
889  * @return true if the child is allowed, or false if not.
890  */
891  virtual bool
892  childTypeAllowed(int xslToken) const;
893 
894  /**
895  * Called after construction is completed. This is a hook for
896  * deriving classes to handle post-construction with the
897  * instances HamespaceHandler instance, which is otherwise only
898  * available through a const accessor.
899  */
900  virtual void
901  namespacesPostConstruction(
902  StylesheetConstructionContext& constructionContext,
903  const NamespacesHandler& theParentHandler,
904  NamespacesHandler& theHandler);
905 
906  const NamespacesHandler&
908  {
909  return m_namespacesHandler;
910  }
911 
912  /**
913  * A convenience function for loading a message
914  * and reporting an error through the provided
915  * StylesheetExecutionContext instance.
916  *
917  * @param theContext The StylesheetExecutionContext to use
918  * @param theCode The code of the message
919  */
920  void
921  error(
922  StylesheetExecutionContext& theContext,
923  XalanMessages::Codes theCode) const;
924 
925  /**
926  * A convenience function for loading a message
927  * and reporting an error through the provided
928  * StylesheetExecutionContext instance.
929  *
930  * @param theContext The StylesheetExecutionContext to use
931  * @param theCode The code of the message
932  * @param theToken The substitution token for the message
933  */
934  void
935  error(
936  StylesheetExecutionContext& theContext,
937  XalanMessages::Codes theCode,
938  const XalanDOMString& theToken) const;
939 
940  /**
941  * A convenience function for loading a message
942  * and reporting an error through the provided
943  * StylesheetExecutionContext instance.
944  *
945  * @param theContext The StylesheetExecutionContext to use
946  * @param theCode The code of the message
947  * @param theLocator The Locator instance to use, if any
948  */
949  void
950  error(
951  StylesheetExecutionContext& theContext,
952  XalanMessages::Codes theCode,
953  const Locator* theLocator) const;
954 
955  /**
956  * A convenience function for loading a message
957  * and reporting a warning through the provided
958  * StylesheetExecutionContext instance.
959  *
960  * @param theContext The StylesheetExecutionContext to use
961  * @param theCode The code of the message
962  */
963  void
964  warn(
965  StylesheetExecutionContext& theContext,
966  XalanMessages::Codes theCode) const;
967 
968  /**
969  * A convenience function for loading a message
970  * and reporting a warning through the provided
971  * StylesheetExecutionContext instance.
972  *
973  * @param theContext The StylesheetExecutionContext to use
974  * @param theCode The code of the message
975  * @param theToken The substitution token for the message
976  */
977  void
978  warn(
979  StylesheetExecutionContext& theContext,
980  XalanMessages::Codes theCode,
981  const XalanDOMString& theToken) const;
982 
983  /**
984  * A convenience function for loading a message
985  * and reporting a warning through the provided
986  * StylesheetExecutionContext instance.
987  *
988  * @param theContext The StylesheetExecutionContext to use
989  * @param theCode The code of the message
990  * @param theLocator The Locator instance to use, if any
991  */
992  void
993  warn(
994  StylesheetExecutionContext& theContext,
995  XalanMessages::Codes theCode,
996  const Locator* theLocator) const;
997 
998  /**
999  * A convenience function for loading a message
1000  * and reporting an error through the provided
1001  * StylesheetConstructionContext instance.
1002  *
1003  * @param theContext The StylesheetConstructionContext to use
1004  * @param theCode The code of the message
1005  */
1006  void
1007  error(
1008  StylesheetConstructionContext& theContext,
1009  XalanMessages::Codes theCode);
1010 
1011  /**
1012  * A convenience function for loading a message
1013  * and reporting an error through the provided
1014  * StylesheetConstructionContext instance.
1015  *
1016  * @param theContext The StylesheetConstructionContext to use
1017  * @param theCode The code of the message
1018  * @param theToken The substitution token for the message
1019  * @param theLocator The Locator instance to use, if any
1020  */
1021  void
1022  error(
1023  StylesheetConstructionContext& theContext,
1024  XalanMessages::Codes theCode,
1025  const XalanDOMString& theToken);
1026 
1027  /**
1028  * A convenience function for loading a message
1029  * and reporting an error through the provided
1030  * StylesheetConstructionContext instance.
1031  *
1032  * @param theContext The StylesheetConstructionContext to use
1033  * @param theCode The code of the message
1034  * @param theToken The substitution token for the message
1035  * @param theLocator The Locator instance to use, if any
1036  */
1037  void
1038  error(
1039  StylesheetConstructionContext& theContext,
1040  XalanMessages::Codes theCode,
1041  const XalanDOMString& theToken,
1042  const Locator* theLocator);
1043 
1044  /**
1045  * A convenience function for loading a message
1046  * and reporting an error through the provided
1047  * StylesheetConstructionContext instance.
1048  *
1049  * @param theContext The StylesheetConstructionContext to use
1050  * @param theCode The code of the message
1051  * @param theToken1 The first substitution token for the message
1052  * @param theToken2 The second substitution token for the message
1053  */
1054  void
1055  error(
1056  StylesheetConstructionContext& theContext,
1057  XalanMessages::Codes theCode,
1058  const XalanDOMString& theToken1,
1059  const XalanDOMString& theToken2);
1060 
1061  /**
1062  * A convenience function for loading a message
1063  * and reporting an error through the provided
1064  * StylesheetConstructionContext instance.
1065  *
1066  * @param theContext The StylesheetConstructionContext to use
1067  * @param theCode The code of the message
1068  * @param theToken1 The first substitution token for the message
1069  * @param theToken2 The second substitution token for the message
1070  */
1071  void
1072  error(
1073  StylesheetConstructionContext& theContext,
1074  XalanMessages::Codes theCode,
1075  const XalanDOMChar* theToken1,
1076  const XalanDOMChar* theToken2);
1077 
1078  /**
1079  * A convenience function for loading a message
1080  * and reporting an error through the provided
1081  * StylesheetConstructionContext instance.
1082  *
1083  * @param theContext The StylesheetConstructionContext to use
1084  * @param theCode The code of the message
1085  * @param theToken1 The first substitution token for the message
1086  * @param theToken2 The second substitution token for the message
1087  * @param theToken3 The third substitution token for the message
1088  */
1089  void
1090  error(
1091  StylesheetConstructionContext& theContext,
1092  XalanMessages::Codes theCode,
1093  const XalanDOMChar* theToken1,
1094  const XalanDOMChar* theToken2,
1095  const XalanDOMChar* theToken3);
1096 
1097  /**
1098  * A convenience function for loading a message
1099  * and reporting a warning through the provided
1100  * StylesheetConstructionContext instance.
1101  *
1102  * @param theContext The StylesheetConstructionContext to use
1103  * @param theCode The code of the message
1104  * @param theToken1 The first substitution token for the message
1105  * @param theToken2 The second substitution token for the message
1106  * @param theToken3 The third substitution token for the message
1107  */
1108  void
1109  warn(
1110  StylesheetConstructionContext& theContext,
1111  XalanMessages::Codes theCode,
1112  const XalanDOMChar* theToken1,
1113  const XalanDOMChar* theToken2,
1114  const XalanDOMChar* theToken3);
1115 
1116  // A handy empty XalanDOMString instance for
1117  // derived classes to use.
1119 
1120 private:
1121 
1122  enum eFlags
1123  {
1124  eHasParams = 1,
1125  eHasSingleTextChild = 2,
1126  eHasVariables = 4,
1127  eHasDirectTemplate = 8,
1128  eCanGenerateAttributes = 16,
1129  eDefaultTemplate = 32,
1130  eSpacePreserve = 64,
1131  eFinishedConstruction = 128,
1132  eHasPrefix = 256,
1133  eDisableOutputEscaping = 512
1134  };
1135 
1136  bool
1137  getFlag(eFlags theFlag) const
1138  {
1139  return m_flags & theFlag ? true : false;
1140  }
1141 
1142  void
1143  setFlag(
1144  eFlags theFlag,
1145  bool theValue)
1146  {
1147  if (theValue == true)
1148  {
1149  m_flags |= theFlag;
1150  }
1151  else
1152  {
1153  m_flags &= ~theFlag;
1154  }
1155  }
1156 
1157 
1158 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
1159  /**
1160  * Take the contents of a template element, process it, and
1161  * convert it to a string.
1162  *
1163  * @param executionContext The current execution context
1164  * @param result result of executing the elements children
1165  * @result a reference to a string containing the result.
1166  */
1168  doChildrenToString(
1169  StylesheetExecutionContext& executionContext,
1170  XalanDOMString& result) const;
1171 #endif
1172 
1173  Stylesheet& m_stylesheet;
1174 
1175  /*
1176  * This object handles all result tree namespace processing.
1177  */
1178  NamespacesHandler m_namespacesHandler;
1179 
1180  const int m_xslToken;
1181 
1182  ElemTemplateElement* m_parentNode;
1183  ElemTemplateElement* m_nextSibling;
1184  ElemTemplateElement* m_previousSibling;
1185 
1186  union
1187  {
1191  };
1192 
1193  LocatorProxy m_locatorProxy;
1194 
1195  unsigned short m_flags;
1196 
1197  static const XalanQNameByReference s_emptyQName;
1198 
1199  // Not implemented...
1201 
1203  operator=(const ElemTemplateElement&);
1204 
1205  bool
1206  operator==(const ElemTemplateElement&) const;
1207 };
1208 
1209 
1210 
1211 XALAN_CPP_NAMESPACE_END
1212 
1213 
1214 
1215 #endif // XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD
bool canGenerateAttributes() const
void hasPrefix(bool value)
This class defines a base class for Locator derivations in Xalan.
const ElemTextLiteral * m_textLiteralChild
static XalanFileLoc getUnknownValue()
ElemTemplateElement * m_firstChild
XalanFileLoc getLineNumber() const
static const XalanDOMString s_emptyString
Definition: XPath.hpp:64
const Stylesheet & getStylesheet() const
Retrieve the stylesheet from which this element comes.
void setFinishedConstruction(bool fValue)
Set the flag indicating construction of the element is completed.
virtual const XalanDOMString & getURI() const =0
Retrieve the base URI for the resolver.
static MemoryManager & getDummyMemMgr()
XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType
const NamespacesHandler & getNamespaces() const
This class defines an interface for classes that resolve namespace prefixes to their URIs...
XalanFileLoc getColumnNumber() const
#define XALAN_XSLT_EXPORT
bool disableOutputEscaping() const
void canGenerateAttributes(bool value)
XALAN_CPP_NAMESPACE_BEGIN typedef XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType
const NamespacesHandler & getNamespacesHandler() const
Get the namespaces handler for this element.
bool operator==(const ElemAttributeSet &theLHS, const ElemAttributeSet &theRHS)
XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType
const XalanDOMString & getURI() const
This class represents the base stylesheet or an "import" stylesheet.
Definition: Stylesheet.hpp:86
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const =0
Retrieve a namespace corresponding to a prefix.
bool getFinishedConstruction() const
Get the flag indicating construction of the element is completed.
XALAN_CPP_NAMESPACE_BEGIN XALAN_USING_XERCES(Locator)
void disableOutputEscaping(bool value)
void preserveSpace(bool value)
Class to represent a qualified name.
Definition: XalanQName.hpp:70
const ElemTemplate * m_directTemplate

Interpreting class diagrams

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

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

Apache Logo