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: TransformState.java 468645 2006-10-28 06:57:24Z minchau $
020     */
021    package org.apache.xalan.transformer;
022    
023    import javax.xml.transform.Transformer;
024    
025    import org.apache.xalan.templates.ElemTemplate;
026    import org.apache.xalan.templates.ElemTemplateElement;
027    import org.apache.xml.serializer.TransformStateSetter;
028    
029    import org.w3c.dom.Node;
030    import org.w3c.dom.traversal.NodeIterator;
031    
032    /**
033     * This interface is meant to be used by a consumer of
034     * SAX2 events produced by Xalan, and enables the consumer
035     * to get information about the state of the transform.  It
036     * is primarily intended as a tooling interface.  A content
037     * handler can get a reference to a TransformState by implementing
038     * the TransformerClient interface.  Xalan will check for
039     * that interface before it calls startDocument, and, if it
040     * is implemented, pass in a TransformState reference to the
041     * setTransformState method.
042     *
043     * <p>Note that the current stylesheet and root stylesheet can
044     * be retrieved from the ElemTemplateElement obtained from
045     * either getCurrentElement() or getCurrentTemplate().</p>
046     * 
047     * This interface contains only getter methods, any setters are in the interface
048     * TransformStateSetter which this interface extends.
049     * 
050     * @see org.apache.xml.serializer.TransformStateSetter
051     */
052    public interface TransformState extends TransformStateSetter
053    {
054    
055      /**
056       * Retrieves the stylesheet element that produced
057       * the SAX event.
058       *
059       * <p>Please note that the ElemTemplateElement returned may
060       * be in a default template, and thus may not be
061       * defined in the stylesheet.</p>
062       *
063       * @return the stylesheet element that produced the SAX event.
064       */
065      ElemTemplateElement getCurrentElement();
066    
067      /**
068       * This method retrieves the current context node
069       * in the source tree.
070       *
071       * @return the current context node in the source tree.
072       */
073      Node getCurrentNode();
074    
075      /**
076       * This method retrieves the xsl:template
077       * that is in effect, which may be a matched template
078       * or a named template.
079       *
080       * <p>Please note that the ElemTemplate returned may
081       * be a default template, and thus may not have a template
082       * defined in the stylesheet.</p>
083       *
084       * @return the xsl:template that is in effect
085       */
086      ElemTemplate getCurrentTemplate();
087    
088      /**
089       * This method retrieves the xsl:template
090       * that was matched.  Note that this may not be
091       * the same thing as the current template (which
092       * may be from getCurrentElement()), since a named
093       * template may be in effect.
094       *
095       * <p>Please note that the ElemTemplate returned may
096       * be a default template, and thus may not have a template
097       * defined in the stylesheet.</p>
098       *
099       * @return the xsl:template that was matched.
100       */
101      ElemTemplate getMatchedTemplate();
102    
103      /**
104       * Retrieves the node in the source tree that matched
105       * the template obtained via getMatchedTemplate().
106       *
107       * @return the node in the source tree that matched
108       * the template obtained via getMatchedTemplate().
109       */
110      Node getMatchedNode();
111    
112      /**
113       * Get the current context node list.
114       *
115       * @return the current context node list.
116       */
117      NodeIterator getContextNodeList();
118    
119      /**
120       * Get the TrAX Transformer object in effect.
121       *
122       * @return the TrAX Transformer object in effect.
123       */
124      Transformer getTransformer();
125      
126    
127        
128    }