001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the "License"); 007 * you may not use this file except in compliance with the License. 008 * You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 /* 019 * $Id: ElemVariablePsuedo.java 468643 2006-10-28 06:56:03Z minchau $ 020 */ 021 package org.apache.xalan.templates; 022 023 import javax.xml.transform.TransformerException; 024 025 import org.apache.xalan.transformer.TransformerImpl; 026 import org.apache.xpath.XPath; 027 028 public class ElemVariablePsuedo extends ElemVariable 029 { 030 static final long serialVersionUID = 692295692732588486L; 031 XUnresolvedVariableSimple m_lazyVar; 032 033 /** 034 * Set the "select" attribute. 035 * If the variable-binding element has a select attribute, 036 * then the value of the attribute must be an expression and 037 * the value of the variable is the object that results from 038 * evaluating the expression. In this case, the content 039 * of the variable must be empty. 040 * 041 * @param v Value to set for the "select" attribute. 042 */ 043 public void setSelect(XPath v) 044 { 045 super.setSelect(v); 046 m_lazyVar = new XUnresolvedVariableSimple(this); 047 } 048 049 /** 050 * Execute a variable declaration and push it onto the variable stack. 051 * @see <a href="http://www.w3.org/TR/xslt#variables">variables in XSLT Specification</a> 052 * 053 * @param transformer non-null reference to the the current transform-time state. 054 * 055 * @throws TransformerException 056 */ 057 public void execute(TransformerImpl transformer) throws TransformerException 058 { 059 060 // if (TransformerImpl.S_DEBUG) 061 // transformer.getTraceManager().fireTraceEvent(this); 062 063 // transformer.getXPathContext().getVarStack().pushVariable(m_qname, var); 064 transformer.getXPathContext().getVarStack().setLocalVariable(m_index, m_lazyVar); 065 } 066 067 } 068