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: SelectionEvent.java 468644 2006-10-28 06:56:42Z minchau $
020     */
021    package org.apache.xalan.trace;
022    
023    import org.apache.xalan.templates.ElemTemplateElement;
024    import org.apache.xalan.transformer.TransformerImpl;
025    import org.apache.xpath.XPath;
026    import org.apache.xpath.objects.XObject;
027    
028    import org.w3c.dom.Node;
029    
030    /**
031     * Event triggered by selection of a node in the style stree.
032     * @xsl.usage advanced
033     */
034    public class SelectionEvent implements java.util.EventListener
035    {
036    
037      /**
038       * The node in the style tree where the event occurs.
039       */
040      public final ElemTemplateElement m_styleNode;
041    
042      /**
043       * The XSLT processor instance.
044       */
045      public final TransformerImpl m_processor;
046    
047      /**
048       * The current context node.
049       */
050      public final Node m_sourceNode;
051    
052      /**
053       * The attribute name from which the selection is made.
054       */
055      public final String m_attributeName;
056    
057      /**
058       * The XPath that executed the selection.
059       */
060      public final XPath m_xpath;
061    
062      /**
063       * The result of the selection.
064       */
065      public final XObject m_selection;
066    
067      /**
068       * Create an event originating at the given node of the style tree.
069       * 
070       * @param processor The XSLT TransformerFactory.
071       * @param sourceNode The current context node.
072       * @param styleNode node in the style tree reference for the event.
073       * Should not be null.  That is not enforced.
074       * @param attributeName The attribute name from which the selection is made.
075       * @param xpath The XPath that executed the selection.
076       * @param selection The result of the selection.
077       */
078      public SelectionEvent(TransformerImpl processor, Node sourceNode,
079                            ElemTemplateElement styleNode, String attributeName,
080                            XPath xpath, XObject selection)
081      {
082    
083        this.m_processor = processor;
084        this.m_sourceNode = sourceNode;
085        this.m_styleNode = styleNode;
086        this.m_attributeName = attributeName;
087        this.m_xpath = xpath;
088        this.m_selection = selection;
089      }
090    }