01: package net.sf.saxon.instruct;
02:
03: import net.sf.saxon.expr.ExpressionTool;
04: import net.sf.saxon.expr.XPathContext;
05: import net.sf.saxon.om.ValueRepresentation;
06: import net.sf.saxon.trans.XPathException;
07:
08: /**
09: * Handler for local xsl:variable elements in stylesheet. Not used in XQuery. <br>
10: */
11:
12: public class LocalVariable extends GeneralVariable {
13:
14: /**
15: * Process the local variable declaration
16: */
17:
18: public TailCall processLeavingTail(XPathContext context)
19: throws XPathException {
20: context.setLocalVariable(getSlotNumber(), ExpressionTool
21: .lazyEvaluate(getSelectExpression(), context, 10));
22: return null;
23: }
24:
25: /**
26: * Evaluate the variable
27: */
28:
29: public ValueRepresentation evaluateVariable(XPathContext c)
30: throws XPathException {
31: return c.evaluateLocalVariable(getSlotNumber());
32: }
33: }
34:
35: //
36: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
37: // you may not use this file except in compliance with the License. You may obtain a copy of the
38: // License at http://www.mozilla.org/MPL/
39: //
40: // Software distributed under the License is distributed on an "AS IS" basis,
41: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
42: // See the License for the specific language governing rights and limitations under the License.
43: //
44: // The Original Code is: all this file.
45: //
46: // The Initial Developer of the Original Code is Michael H. Kay.
47: //
48: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
49: //
50: // Contributor(s): none.
51: //
|