19f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/* 29f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one 39f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or more contributor license agreements. See the NOTICE file 49f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed with this work for additional information 59f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * regarding copyright ownership. The ASF licenses this file 69f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to you under the Apache License, Version 2.0 (the "License"); 79f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * you may not use this file except in compliance with the License. 89f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * You may obtain a copy of the License at 99f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * http://www.apache.org/licenses/LICENSE-2.0 119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Unless required by applicable law or agreed to in writing, software 139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS, 149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * See the License for the specific language governing permissions and 169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * limitations under the License. 179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/* 199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * $Id: TransformState.java 468645 2006-10-28 06:57:24Z minchau $ 209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpackage org.apache.xalan.transformer; 229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport javax.xml.transform.Transformer; 249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xalan.templates.ElemTemplate; 269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xalan.templates.ElemTemplateElement; 279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xml.serializer.TransformStateSetter; 289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.w3c.dom.Node; 309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.w3c.dom.traversal.NodeIterator; 319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/** 339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This interface is meant to be used by a consumer of 349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * SAX2 events produced by Xalan, and enables the consumer 359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to get information about the state of the transform. It 369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * is primarily intended as a tooling interface. A content 379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * handler can get a reference to a TransformState by implementing 389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the TransformerClient interface. Xalan will check for 399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * that interface before it calls startDocument, and, if it 409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * is implemented, pass in a TransformState reference to the 419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * setTransformState method. 429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>Note that the current stylesheet and root stylesheet can 449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * be retrieved from the ElemTemplateElement obtained from 459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * either getCurrentElement() or getCurrentTemplate().</p> 469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This interface contains only getter methods, any setters are in the interface 489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * TransformStateSetter which this interface extends. 499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @see org.apache.xml.serializer.TransformStateSetter 519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpublic interface TransformState extends TransformStateSetter 539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson{ 549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Retrieves the stylesheet element that produced 579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the SAX event. 589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>Please note that the ElemTemplateElement returned may 609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * be in a default template, and thus may not be 619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * defined in the stylesheet.</p> 629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the stylesheet element that produced the SAX event. 649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson ElemTemplateElement getCurrentElement(); 669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This method retrieves the current context node 699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * in the source tree. 709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the current context node in the source tree. 729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson Node getCurrentNode(); 749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This method retrieves the xsl:template 779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * that is in effect, which may be a matched template 789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or a named template. 799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>Please note that the ElemTemplate returned may 819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * be a default template, and thus may not have a template 829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * defined in the stylesheet.</p> 839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the xsl:template that is in effect 859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson ElemTemplate getCurrentTemplate(); 879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This method retrieves the xsl:template 909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * that was matched. Note that this may not be 919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the same thing as the current template (which 929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * may be from getCurrentElement()), since a named 939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * template may be in effect. 949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>Please note that the ElemTemplate returned may 969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * be a default template, and thus may not have a template 979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * defined in the stylesheet.</p> 989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the xsl:template that was matched. 1009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson ElemTemplate getMatchedTemplate(); 1029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Retrieves the node in the source tree that matched 1059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the template obtained via getMatchedTemplate(). 1069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the node in the source tree that matched 1089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the template obtained via getMatchedTemplate(). 1099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson Node getMatchedNode(); 1119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get the current context node list. 1149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the current context node list. 1169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson NodeIterator getContextNodeList(); 1189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get the TrAX Transformer object in effect. 1219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the TrAX Transformer object in effect. 1239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson Transformer getTransformer(); 1259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson} 129