1 16 19 package org.apache.xalan.templates; 20 21 import org.apache.xalan.res.XSLTErrorResources; 22 import org.apache.xalan.transformer.TransformerImpl; 23 import org.apache.xpath.VariableStack; 24 import org.apache.xpath.XPathContext; 25 import org.apache.xpath.objects.XObject; 26 27 32 public class XUnresolvedVariable extends XObject 33 { 34 35 transient private int m_context; 36 37 38 transient private TransformerImpl m_transformer; 39 40 44 transient private int m_varStackPos = -1; 45 46 49 transient private int m_varStackContext; 50 51 53 private boolean m_isGlobal; 54 55 56 transient private boolean m_doneEval = true; 57 58 74 public XUnresolvedVariable(ElemVariable obj, int sourceNode, 75 TransformerImpl transformer, 76 int varStackPos, int varStackContext, 77 boolean isGlobal) 78 { 79 super(obj); 80 m_context = sourceNode; 81 m_transformer = transformer; 82 83 m_varStackPos = varStackPos; 86 87 m_varStackContext = varStackContext; 89 90 m_isGlobal = isGlobal; 91 } 92 93 102 public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException 103 { 104 if (!m_doneEval) 105 { 106 this.m_transformer.getMsgMgr().error 107 (xctxt.getSAXLocator(), XSLTErrorResources.ER_REFERENCING_ITSELF, 108 new Object []{((ElemVariable)this.object()).getName().getLocalName()}); 109 } 110 VariableStack vars = xctxt.getVarStack(); 111 112 int currentFrame = vars.getStackFrame(); 114 116 117 ElemVariable velem = (ElemVariable)m_obj; 118 try 119 { 120 m_doneEval = false; 121 if(-1 != velem.m_frameSize) 122 vars.link(velem.m_frameSize); 123 XObject var = velem.getValue(m_transformer, m_context); 124 m_doneEval = true; 125 return var; 126 } 127 finally 128 { 129 132 if(-1 != velem.m_frameSize) 133 vars.unlink(currentFrame); 134 } 135 } 136 137 145 public void setVarStackPos(int top) 146 { 147 m_varStackPos = top; 148 } 149 150 157 public void setVarStackContext(int bottom) 158 { 159 m_varStackContext = bottom; 160 } 161 162 167 public int getType() 168 { 169 return CLASS_UNRESOLVEDVARIABLE; 170 } 171 172 178 public String getTypeString() 179 { 180 return "XUnresolvedVariable (" + object().getClass().getName() + ")"; 181 } 182 183 184 } 185 | Popular Tags |