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_ELEMLITERALRESULT_HEADER_GUARD) 19 #define XALAN_ELEMLITERALRESULT_HEADER_GUARD 20 21 22 23 // Base include file. Must be first. 24 #include <xalanc/XSLT/XSLTDefinitions.hpp> 25 26 27 28 // Base class header file. 29 #include <xalanc/XSLT/ElemUse.hpp> 30 31 32 33 namespace XALAN_CPP_NAMESPACE { 34 35 36 37 class AVT; 38 39 40 41 class ElemLiteralResult: public ElemUse 42 { 43 public: 44 45 /** 46 * Construct an object corresponding to a literal result element 47 * 48 * @param constructionContext context for construction of object 49 * @param stylesheetTree stylesheet containing element 50 * @param name name of element 51 * @param atts list of attributes for element 52 * @param lineNumber line number in document 53 * @param columnNumber column number in document 54 */ 55 ElemLiteralResult( 56 StylesheetConstructionContext& constructionContext, 57 Stylesheet& stylesheetTree, 58 const XalanDOMChar* name, 59 const AttributeListType& atts, 60 XalanFileLoc lineNumber, 61 XalanFileLoc columnNumber); 62 63 virtual 64 ~ElemLiteralResult(); 65 66 // These methods are inherited from ElemUse ... 67 68 virtual const XalanDOMString& 69 getElementName() const; 70 71 virtual void 72 postConstruction( 73 StylesheetConstructionContext& constructionContext, 74 const NamespacesHandler& theParentHandler); 75 76 virtual bool 77 isAttrOK( 78 const XalanDOMChar* attrName, 79 const AttributeListType& atts, 80 XalanSize_t which, 81 StylesheetConstructionContext& constructionContext) const; 82 83 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 84 virtual const ElemTemplateElement* 85 startElement(StylesheetExecutionContext& executionContext) const; 86 87 virtual void 88 endElement(StylesheetExecutionContext& executionContext) const; 89 90 virtual void 91 evaluateAVTs(StylesheetExecutionContext& executionContext) const; 92 #else 93 virtual void 94 execute(StylesheetExecutionContext& executionContext) const; 95 #endif 96 97 protected: 98 99 /** 100 * Do common initialization. 101 * 102 * @param constructionContext The current onstruction context. 103 * @param stylesheetTree The stylesheet containing the element. 104 * @param name The name of the element. 105 * @param atts The list of attributes for the element. 106 */ 107 void 108 init( 109 StylesheetConstructionContext& constructionContext, 110 Stylesheet& stylesheetTree, 111 const XalanDOMChar* name, 112 const AttributeListType& atts); 113 114 /** 115 * Construct an object corresponding to a literal result element 116 * 117 * @param constructionContext context for construction of object 118 * @param stylesheetTree stylesheet containing element 119 * @param name name of element 120 * @param atts list of attributes for element 121 * @param lineNumber line number in document 122 * @param columnNumber column number in document 123 * @param xslToken The xsl token value for this class 124 */ 125 ElemLiteralResult( 126 StylesheetConstructionContext& constructionContext, 127 Stylesheet& stylesheetTree, 128 const XalanDOMChar* name, 129 const AttributeListType& atts, 130 XalanFileLoc lineNumber, 131 XalanFileLoc columnNumber, 132 int xslToken); 133 134 virtual void 135 namespacesPostConstruction( 136 StylesheetConstructionContext& constructionContext, 137 const NamespacesHandler& theParentHandler, 138 NamespacesHandler& theHandler); 139 140 private: 141 142 // not implemented 143 ElemLiteralResult(const ElemLiteralResult &); 144 145 ElemLiteralResult& 146 operator=(const ElemLiteralResult&); 147 148 149 /** 150 * The name of the literal result element. 151 */ 152 const XalanDOMString& m_elementName; 153 154 /** 155 * A vector to keep track of the attribute elements. 156 */ 157 const AVT** m_avts; 158 159 /** 160 * The size of m_avts, once the stylesheet is compiled... 161 */ 162 XalanSize_t m_avtsCount; 163 }; 164 165 166 167 } 168 169 170 171 #endif // XALAN_ELEMLITERALRESULT_HEADER_GUARD 172