Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

Stylesheet.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #if !defined(XALAN_STYLESHEET_HEADER_GUARD)
18 #define XALAN_STYLESHEET_HEADER_GUARD
19 
20 
21 
22 // Base include file. Must be first.
23 #include "XSLTDefinitions.hpp"
24 
25 
26 
29 
30 
31 
34 
35 
36 
38 
39 
40 
43 #include <xalanc/XPath/XPath.hpp>
44 
45 
46 
52 
53 
54 
55 XALAN_CPP_NAMESPACE_BEGIN
56 
57 
58 
59 class ExtensionNSHandler;
61 class ElemDecimalFormat;
62 class ElemTemplate;
64 class ElemVariable;
65 class KeyTable;
66 class NodeRefListBase;
67 class PrefixResolver;
69 class StylesheetRoot;
71 class XalanQName;
72 class XObject;
74 
75 
78 
79 
80 
85 {
86 
87 public:
88 
93 
101 
103 
106 
108 
110 
112 
118  Stylesheet(
119  StylesheetRoot& root,
120  const XalanDOMString& baseIdentifier,
121  StylesheetConstructionContext& constructionContext);
122 
123  virtual
124  ~Stylesheet();
125 
126  static Stylesheet*
127  create(MemoryManagerType& theManager,
128  StylesheetRoot& root,
129  const XalanDOMString& baseIdentifier,
130  StylesheetConstructionContext& constructionContext);
131 
134  {
135  return m_elementPatternTable.getMemoryManager();
136  }
137 
143  double
145  {
146  return m_XSLTVerDeclared;
147  }
148 
154  void
155  setXSLTVerDeclared(double ver)
156  {
157  m_XSLTVerDeclared = ver;
158  }
159 
165  const StylesheetRoot&
167  {
168  return m_stylesheetRoot;
169  }
170 
178  {
179  return m_stylesheetRoot;
180  }
181 
187  const NamespacesStackType&
189  {
190  return m_namespaces;
191  }
192 
198  NamespacesStackType&
200  {
201  return m_namespaces;
202  }
203 
204  const NamespacesHandler&
206  {
207  return m_namespacesHandler;
208  }
209 
212  {
213  return m_namespacesHandler;
214  }
215 
221  const NamespaceVectorType&
223  {
224  return m_namespaceDecls;
225  }
226 
232  NamespaceVectorType&
234  {
235  return m_namespaceDecls;
236  }
237 
243  void
244  setNamespaceDecls(const NamespaceVectorType& ns)
245  {
246  m_namespaceDecls = ns;
247  }
248 
255  void
256  pushNamespaces(const AttributeListType& atts);
257 
261  void
263  {
264  assert(m_namespaces.empty() == false);
265 
266  m_namespaces.pop_back();
267  }
268 
269  void
270  addWhitespaceElement(const XalanSpaceNodeTester& theTester);
271 
275  virtual void
276  postConstruction(StylesheetConstructionContext& constructionContext);
277 
287  bool
288  isAttrOK(
289  const XalanDOMChar* attrName,
290  const AttributeListType& atts,
291  int which,
292  StylesheetConstructionContext& constructionContext) const;
293 
300  const XalanDOMString*
302  XalanDOMString& theBuffer) const
303  {
304  return getNamespaceFromStack(c_wstr(nodeName), theBuffer);
305  }
306 
313  const XalanDOMString*
314  getNamespaceFromStack(const XalanDOMChar* nodeName,
315  XalanDOMString& theBuffer) const;
316 
324  const XalanDOMString*
326  {
327  return XalanQName::getNamespaceForPrefix(m_namespaces, prefix);
328  }
329 
337  const XalanDOMString*
338  getNamespaceForPrefixFromStack(const XalanDOMChar* prefix) const
339  {
340  assert(prefix != 0);
341 
342  return XalanQName::getNamespaceForPrefix(m_namespaces, (const XalanDOMChar*)prefix);
343  }
344 
352  const XalanDOMString*
354  const XalanDOMString& prefix,
355  StylesheetConstructionContext& constructionContext) const;
356 
364  const XalanDOMString*
366  const XalanDOMChar* prefix,
367  StylesheetConstructionContext& constructionContext) const;
368 
376  void
378  StylesheetConstructionContext& theConstructionContext,
379  const XalanDOMChar* theValue)
380  {
381  m_namespacesHandler.processExcludeResultPrefixes(
382  theConstructionContext,
383  theValue,
384  m_namespaces);
385  }
386 
393  void
394  addTemplate(
395  ElemTemplate* theTemplate,
396  StylesheetConstructionContext& constructionContext);
397 
406  bool
407  getYesOrNo(
408  const XalanDOMChar* aname,
409  const XalanDOMChar* val,
410  StylesheetConstructionContext& constructionContext) const;
411 
417  const XalanDOMString&
419  {
420  return m_baseIdent;
421  }
422 
431  const XalanDOMString&
433  {
434  return m_includeStack.empty() == true ? getBaseIdentifier() : m_includeStack.back();
435  }
436 
444  void
445  processNSAliasElement(
446  const XalanDOMChar* name,
447  const AttributeListType& atts,
448  StylesheetConstructionContext& constructionContext);
449 
455  void
456  processDecimalFormatElement(
457  StylesheetConstructionContext& constructionContext,
458  const AttributeListType& atts,
459  const LocatorType* locator = 0);
460 
469  getDecimalFormatSymbols(const XalanQName& theQName) const;
470 
476  void
477  addImport(Stylesheet* theStylesheet)
478  {
479  m_imports.insert(m_imports.begin(), theStylesheet);
480  }
481 
487  bool
489  {
490  return m_isWrapperless;
491  }
492 
494  initWrapperless(
495  StylesheetConstructionContext& constructionContext,
496  const LocatorType* locator);
497 
503  URLStackType&
505  {
506  return m_includeStack;
507  }
508 
517  void
518  processKeyElement(
519  const PrefixResolver& nsContext,
520  const AttributeListType& atts,
521  const LocatorType* locator,
522  StylesheetConstructionContext& constructionContext);
523 
530  const ElemTemplate*
531  findNamedTemplate(const XalanQName& qname) const;
532 
541  const ElemTemplate*
543  StylesheetExecutionContext& executionContext,
544  XalanNode* targetNode) const
545  {
546  assert(targetNode != 0);
547 
548  return findTemplate(
549  executionContext,
550  targetNode,
551  targetNode->getNodeType(),
552  s_emptyQName,
553  false);
554  }
555 
567  const ElemTemplate*
568  findTemplate(
569  StylesheetExecutionContext& executionContext,
570  XalanNode* targetNode,
571  XalanNode::NodeType targetNodeType,
572  const XalanQName& mode,
573  bool onlyUseImports) const;
574 
581  static void
582  addObjectIfNotFound(
583  const XalanMatchPatternData* thePattern,
584  PatternTableVectorType& theVector);
585 
595  static void
596  addObjectIfNotFound(
597  const XalanMatchPatternData* thePattern,
598  const XalanMatchPatternData* theArray[],
599  unsigned int& theArraySize);
600 
608  const PatternTableVectorType*
609  locateElementMatchPatternDataList(const XalanDOMString& theName) const;
610 
618  const PatternTableVectorType*
619  locateAttributeMatchPatternDataList(const XalanDOMString& theName) const;
620 
627  const PatternTableVectorType*
628  locateMatchPatternDataList(
629  const XalanNode& theNode,
630  XalanNode::NodeType targetNodeType) const;
631 
640  void
641  processExtensionNamespace(
642  StylesheetConstructionContext& theConstructionContext,
643  const XalanDOMString& uri);
644 
653  {
655  m_extensionNamespaces.find(uri);
656 
657  return it == m_extensionNamespaces.end() ? 0 : (*it).second;
658  }
659 
666  void
668  {
669  m_topLevelVariables.push_back(var);
670  }
671 
679  void
681  StylesheetExecutionContext& executionContext,
682  const ParamVectorType& topLevelParams) const;
683 
684 
685  // These interfaces are inherited from PrefixResolver...
686 
687  virtual const XalanDOMString*
688  getNamespaceForPrefix(const XalanDOMString& prefix) const;
689 
690  virtual const XalanDOMString&
691  getURI() const;
692 
693  const XalanDOMString&
695  {
696  return m_XSLTNamespaceURI;
697  }
698 
699  void
701  {
702  m_XSLTNamespaceURI = theURI;
703  }
704 
705  const ElemTemplate*
707  {
708  return m_firstTemplate;
709  }
710 
711 protected:
712 
717 
722 
727  KeyDeclarationVectorType m_keyDeclarations;
728 
729  WhitespaceElementsVectorType m_whitespaceElements;
730 
731  static const XalanQNameByReference s_emptyQName;
732 
733 private:
734 
735  // Not defined...
736  Stylesheet(const Stylesheet&);
737 
738  Stylesheet&
739  operator=(const Stylesheet&);
740 
741  bool
742  operator==(const Stylesheet&) const;
743 
744 
755  const ElemTemplate*
756  findTemplateInImports(
757  StylesheetExecutionContext& executionContext,
758  XalanNode* targetNode,
759  XalanNode::NodeType targetNodeType,
760  const XalanQName& mode) const;
761 
766  XalanDOMString m_XSLTNamespaceURI;
767 
771  StylesheetVectorType m_imports;
772 
773  StylesheetVectorType::size_type m_importsSize;
774 
778  NamespacesStackType m_namespaces;
779 
784  NamespaceVectorType m_namespaceDecls;
785 
790  bool m_isWrapperless;
791 
795  ExtensionNamespacesMapType m_extensionNamespaces;
796 
800  ElemTemplate* m_firstTemplate;
801 
806  URLStackType m_includeStack;
807 
813  ElemTemplateMapType m_namedTemplates;
814 
818  ElemVariableVectorType m_topLevelVariables;
819 
823  double m_XSLTVerDeclared;
824 
830  PatternTableMapType m_elementPatternTable;
831 
832  const PatternTableMapType::const_iterator m_elementPatternTableEnd;
833 
834  PatternTableVectorType m_elementAnyPatternList;
835 
841  PatternTableMapType m_attributePatternTable;
842 
843  const PatternTableMapType::const_iterator m_attributePatternTableEnd;
844 
845  PatternTableVectorType m_attributeAnyPatternList;
846 
850  PatternTableVectorType m_textPatternList;
851 
852  PatternTableVectorType m_commentPatternList;
853 
854  PatternTableVectorType m_rootPatternList;
855 
856  PatternTableVectorType m_piPatternList;
857 
861  PatternTableVectorType m_nodePatternList;
862 
863  size_type m_patternCount;
864 
865  ElemDecimalFormatVectorType m_elemDecimalFormats;
866 
867  NamespacesHandler m_namespacesHandler;
868 
869  static const XalanDOMString s_emptyString;
870 };
871 
872 
873 
874 XALAN_CPP_NAMESPACE_END
875 
876 
877 
878 #endif // XALAN_STYLESHEET_HEADER_GUARD

Interpreting class diagrams

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

dot

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

Apache Logo