14c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/*
24c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one
34c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * or more contributor license agreements. See the NOTICE file
44c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * distributed with this work for additional information
54c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * regarding copyright ownership. The ASF licenses this file
64c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * to you under the Apache License, Version 2.0 (the  "License");
74c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * you may not use this file except in compliance with the License.
84c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * You may obtain a copy of the License at
94c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *
104c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *     http://www.apache.org/licenses/LICENSE-2.0
114c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *
124c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * Unless required by applicable law or agreed to in writing, software
134c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS,
144c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
154c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * See the License for the specific language governing permissions and
164c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * limitations under the License.
174c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */
184c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/*
194c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * $Id: ProcessorGlobalParamDecl.java 468640 2006-10-28 06:53:53Z minchau $
204c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */
214c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonpackage org.apache.xalan.processor;
224c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
234c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonimport org.apache.xalan.templates.ElemParam;
244c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonimport org.apache.xalan.templates.ElemTemplateElement;
254c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
264c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/**
274c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * This class processes parse events for an xsl:param element.
284c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
294c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
304c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */
314c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonclass ProcessorGlobalParamDecl extends ProcessorTemplateElem
324c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson{
334c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    static final long serialVersionUID = 1900450872353587350L;
344c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
354c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  /**
364c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * Append the current template element to the current
374c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * template element, and then push it onto the current template
384c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * element stack.
394c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
404c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
414c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param elem The non-null reference to the ElemParam element.
424c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
434c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
444c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *            wrapping another exception.
454c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   */
464c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  protected void appendAndPush(
474c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson          StylesheetHandler handler, ElemTemplateElement elem)
484c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson            throws org.xml.sax.SAXException
494c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  {
504c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
514c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // Just push, but don't append.
524c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    handler.pushElemTemplateElement(elem);
534c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  }
544c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
554c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  /**
564c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * Receive notification of the end of an element.
574c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
584c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param name The element type name.
594c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param attributes The specified or defaulted attributes.
604c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
614c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
624c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param uri The Namespace URI, or an empty string.
634c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param localName The local name (without prefix), or empty string if not namespace processing.
644c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param rawName The qualified name (with prefix).
654c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   */
664c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  public void endElement(
674c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson          StylesheetHandler handler, String uri, String localName, String rawName)
684c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson            throws org.xml.sax.SAXException
694c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  {
704c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
714c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    ElemParam v = (ElemParam) handler.getElemTemplateElement();
724c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
734c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    handler.getStylesheet().appendChild(v);
744c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    handler.getStylesheet().setParam(v);
754c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    super.endElement(handler, uri, localName, rawName);
764c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  }
774c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson}
78