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: XSLTVisitor.java 468643 2006-10-28 06:56:03Z minchau $
020 */
021 package org.apache.xalan.templates;
022
023 import org.apache.xpath.XPathVisitor;
024
025 /**
026 * A derivation from this class can be passed to a class that implements
027 * the XSLTVisitable interface, to have the appropriate method called
028 * for each component of an XSLT stylesheet. Aside from possible other uses,
029 * the main intention is to provide a reasonable means to perform expression
030 * rewriting.
031 */
032 public class XSLTVisitor extends XPathVisitor
033 {
034 /**
035 * Visit an XSLT instruction. Any element that isn't called by one
036 * of the other visit methods, will be called by this method.
037 *
038 * @param elem The xsl instruction element object.
039 * @return true if the sub expressions should be traversed.
040 */
041 public boolean visitInstruction(ElemTemplateElement elem)
042 {
043 return true;
044 }
045
046 /**
047 * Visit an XSLT stylesheet instruction.
048 *
049 * @param elem The xsl instruction element object.
050 * @return true if the sub expressions should be traversed.
051 */
052 public boolean visitStylesheet(ElemTemplateElement elem)
053 {
054 return true;
055 }
056
057
058 /**
059 * Visit an XSLT top-level instruction.
060 *
061 * @param elem The xsl instruction element object.
062 * @return true if the sub expressions should be traversed.
063 */
064 public boolean visitTopLevelInstruction(ElemTemplateElement elem)
065 {
066 return true;
067 }
068
069 /**
070 * Visit an XSLT top-level instruction.
071 *
072 * @param elem The xsl instruction element object.
073 * @return true if the sub expressions should be traversed.
074 */
075 public boolean visitTopLevelVariableOrParamDecl(ElemTemplateElement elem)
076 {
077 return true;
078 }
079
080
081 /**
082 * Visit an XSLT variable or parameter declaration.
083 *
084 * @param elem The xsl instruction element object.
085 * @return true if the sub expressions should be traversed.
086 */
087 public boolean visitVariableOrParamDecl(ElemVariable elem)
088 {
089 return true;
090 }
091
092 /**
093 * Visit a LiteralResultElement.
094 *
095 * @param elem The literal result object.
096 * @return true if the sub expressions should be traversed.
097 */
098 public boolean visitLiteralResultElement(ElemLiteralResult elem)
099 {
100 return true;
101 }
102
103 /**
104 * Visit an Attribute Value Template (at the top level).
105 *
106 * @param elem The attribute value template object.
107 * @return true if the sub expressions should be traversed.
108 */
109 public boolean visitAVT(AVT elem)
110 {
111 return true;
112 }
113
114
115 /**
116 * Visit an extension element.
117 * @param elem The extension object.
118 * @return true if the sub expressions should be traversed.
119 */
120 public boolean visitExtensionElement(ElemExtensionCall elem)
121 {
122 return true;
123 }
124
125 }
126