Home | History | Annotate | Download | only in templates
      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 /*
     19  * $Id: ElemVariablePsuedo.java 468643 2006-10-28 06:56:03Z minchau $
     20  */
     21 package org.apache.xalan.templates;
     22 
     23 import javax.xml.transform.TransformerException;
     24 
     25 import org.apache.xalan.transformer.TransformerImpl;
     26 import org.apache.xpath.XPath;
     27 
     28 public class ElemVariablePsuedo extends ElemVariable
     29 {
     30     static final long serialVersionUID = 692295692732588486L;
     31   XUnresolvedVariableSimple m_lazyVar;
     32 
     33   /**
     34    * Set the "select" attribute.
     35    * If the variable-binding element has a select attribute,
     36    * then the value of the attribute must be an expression and
     37    * the value of the variable is the object that results from
     38    * evaluating the expression. In this case, the content
     39    * of the variable must be empty.
     40    *
     41    * @param v Value to set for the "select" attribute.
     42    */
     43   public void setSelect(XPath v)
     44   {
     45     super.setSelect(v);
     46     m_lazyVar = new XUnresolvedVariableSimple(this);
     47   }
     48 
     49   /**
     50    * Execute a variable declaration and push it onto the variable stack.
     51    * @see <a href="http://www.w3.org/TR/xslt#variables">variables in XSLT Specification</a>
     52    *
     53    * @param transformer non-null reference to the the current transform-time state.
     54    *
     55    * @throws TransformerException
     56    */
     57   public void execute(TransformerImpl transformer) throws TransformerException
     58   {
     59 
     60     // if (TransformerImpl.S_DEBUG)
     61     //  transformer.getTraceManager().fireTraceEvent(this);
     62 
     63     // transformer.getXPathContext().getVarStack().pushVariable(m_qname, var);
     64     transformer.getXPathContext().getVarStack().setLocalVariable(m_index, m_lazyVar);
     65   }
     66 
     67 }
     68 
     69