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: ProcessorGlobalParamDecl.java 468640 2006-10-28 06:53:53Z minchau $
020     */
021    package org.apache.xalan.processor;
022    
023    import org.apache.xalan.templates.ElemParam;
024    import org.apache.xalan.templates.ElemTemplateElement;
025    
026    /**
027     * This class processes parse events for an xsl:param element.
028     * @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
029     * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
030     */
031    class ProcessorGlobalParamDecl extends ProcessorTemplateElem
032    {
033        static final long serialVersionUID = 1900450872353587350L;
034    
035      /**
036       * Append the current template element to the current
037       * template element, and then push it onto the current template
038       * element stack.
039       *
040       * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
041       * @param elem The non-null reference to the ElemParam element.
042       *
043       * @throws org.xml.sax.SAXException Any SAX exception, possibly
044       *            wrapping another exception.
045       */
046      protected void appendAndPush(
047              StylesheetHandler handler, ElemTemplateElement elem)
048                throws org.xml.sax.SAXException
049      {
050    
051        // Just push, but don't append.
052        handler.pushElemTemplateElement(elem);
053      }
054    
055      /**
056       * Receive notification of the end of an element.
057       *
058       * @param name The element type name.
059       * @param attributes The specified or defaulted attributes.
060       *
061       * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
062       * @param uri The Namespace URI, or an empty string.
063       * @param localName The local name (without prefix), or empty string if not namespace processing.
064       * @param rawName The qualified name (with prefix).
065       */
066      public void endElement(
067              StylesheetHandler handler, String uri, String localName, String rawName)
068                throws org.xml.sax.SAXException
069      {
070    
071        ElemParam v = (ElemParam) handler.getElemTemplateElement();
072    
073        handler.getStylesheet().appendChild(v);
074        handler.getStylesheet().setParam(v);
075        super.endElement(handler, uri, localName, rawName);
076      }
077    }