Home | History | Annotate | Download | only in processor
      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: ProcessorGlobalParamDecl.java 468640 2006-10-28 06:53:53Z minchau $
     20  */
     21 package org.apache.xalan.processor;
     22 
     23 import org.apache.xalan.templates.ElemParam;
     24 import org.apache.xalan.templates.ElemTemplateElement;
     25 
     26 /**
     27  * This class processes parse events for an xsl:param element.
     28  * @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
     29  * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
     30  */
     31 class ProcessorGlobalParamDecl extends ProcessorTemplateElem
     32 {
     33     static final long serialVersionUID = 1900450872353587350L;
     34 
     35   /**
     36    * Append the current template element to the current
     37    * template element, and then push it onto the current template
     38    * element stack.
     39    *
     40    * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
     41    * @param elem The non-null reference to the ElemParam element.
     42    *
     43    * @throws org.xml.sax.SAXException Any SAX exception, possibly
     44    *            wrapping another exception.
     45    */
     46   protected void appendAndPush(
     47           StylesheetHandler handler, ElemTemplateElement elem)
     48             throws org.xml.sax.SAXException
     49   {
     50 
     51     // Just push, but don't append.
     52     handler.pushElemTemplateElement(elem);
     53   }
     54 
     55   /**
     56    * Receive notification of the end of an element.
     57    *
     58    * @param name The element type name.
     59    * @param attributes The specified or defaulted attributes.
     60    *
     61    * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
     62    * @param uri The Namespace URI, or an empty string.
     63    * @param localName The local name (without prefix), or empty string if not namespace processing.
     64    * @param rawName The qualified name (with prefix).
     65    */
     66   public void endElement(
     67           StylesheetHandler handler, String uri, String localName, String rawName)
     68             throws org.xml.sax.SAXException
     69   {
     70 
     71     ElemParam v = (ElemParam) handler.getElemTemplateElement();
     72 
     73     handler.getStylesheet().appendChild(v);
     74     handler.getStylesheet().setParam(v);
     75     super.endElement(handler, uri, localName, rawName);
     76   }
     77 }
     78