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: TransformState.java 468645 2006-10-28 06:57:24Z minchau $
20 */
21package org.apache.xalan.transformer;
22
23import javax.xml.transform.Transformer;
24
25import org.apache.xalan.templates.ElemTemplate;
26import org.apache.xalan.templates.ElemTemplateElement;
27import org.apache.xml.serializer.TransformStateSetter;
28
29import org.w3c.dom.Node;
30import org.w3c.dom.traversal.NodeIterator;
31
32/**
33 * This interface is meant to be used by a consumer of
34 * SAX2 events produced by Xalan, and enables the consumer
35 * to get information about the state of the transform.  It
36 * is primarily intended as a tooling interface.  A content
37 * handler can get a reference to a TransformState by implementing
38 * the TransformerClient interface.  Xalan will check for
39 * that interface before it calls startDocument, and, if it
40 * is implemented, pass in a TransformState reference to the
41 * setTransformState method.
42 *
43 * <p>Note that the current stylesheet and root stylesheet can
44 * be retrieved from the ElemTemplateElement obtained from
45 * either getCurrentElement() or getCurrentTemplate().</p>
46 *
47 * This interface contains only getter methods, any setters are in the interface
48 * TransformStateSetter which this interface extends.
49 *
50 * @see org.apache.xml.serializer.TransformStateSetter
51 */
52public interface TransformState extends TransformStateSetter
53{
54
55  /**
56   * Retrieves the stylesheet element that produced
57   * the SAX event.
58   *
59   * <p>Please note that the ElemTemplateElement returned may
60   * be in a default template, and thus may not be
61   * defined in the stylesheet.</p>
62   *
63   * @return the stylesheet element that produced the SAX event.
64   */
65  ElemTemplateElement getCurrentElement();
66
67  /**
68   * This method retrieves the current context node
69   * in the source tree.
70   *
71   * @return the current context node in the source tree.
72   */
73  Node getCurrentNode();
74
75  /**
76   * This method retrieves the xsl:template
77   * that is in effect, which may be a matched template
78   * or a named template.
79   *
80   * <p>Please note that the ElemTemplate returned may
81   * be a default template, and thus may not have a template
82   * defined in the stylesheet.</p>
83   *
84   * @return the xsl:template that is in effect
85   */
86  ElemTemplate getCurrentTemplate();
87
88  /**
89   * This method retrieves the xsl:template
90   * that was matched.  Note that this may not be
91   * the same thing as the current template (which
92   * may be from getCurrentElement()), since a named
93   * template may be in effect.
94   *
95   * <p>Please note that the ElemTemplate returned may
96   * be a default template, and thus may not have a template
97   * defined in the stylesheet.</p>
98   *
99   * @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}
129