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: XSLTVisitor.java 468643 2006-10-28 06:56:03Z minchau $ 20 */ 21 package org.apache.xalan.templates; 22 23 import org.apache.xpath.XPathVisitor; 24 25 /** 26 * A derivation from this class can be passed to a class that implements 27 * the XSLTVisitable interface, to have the appropriate method called 28 * for each component of an XSLT stylesheet. Aside from possible other uses, 29 * the main intention is to provide a reasonable means to perform expression 30 * rewriting. 31 */ 32 public class XSLTVisitor extends XPathVisitor 33 { 34 /** 35 * Visit an XSLT instruction. Any element that isn't called by one 36 * of the other visit methods, will be called by this method. 37 * 38 * @param elem The xsl instruction element object. 39 * @return true if the sub expressions should be traversed. 40 */ 41 public boolean visitInstruction(ElemTemplateElement elem) 42 { 43 return true; 44 } 45 46 /** 47 * Visit an XSLT stylesheet instruction. 48 * 49 * @param elem The xsl instruction element object. 50 * @return true if the sub expressions should be traversed. 51 */ 52 public boolean visitStylesheet(ElemTemplateElement elem) 53 { 54 return true; 55 } 56 57 58 /** 59 * Visit an XSLT top-level instruction. 60 * 61 * @param elem The xsl instruction element object. 62 * @return true if the sub expressions should be traversed. 63 */ 64 public boolean visitTopLevelInstruction(ElemTemplateElement elem) 65 { 66 return true; 67 } 68 69 /** 70 * Visit an XSLT top-level instruction. 71 * 72 * @param elem The xsl instruction element object. 73 * @return true if the sub expressions should be traversed. 74 */ 75 public boolean visitTopLevelVariableOrParamDecl(ElemTemplateElement elem) 76 { 77 return true; 78 } 79 80 81 /** 82 * Visit an XSLT variable or parameter declaration. 83 * 84 * @param elem The xsl instruction element object. 85 * @return true if the sub expressions should be traversed. 86 */ 87 public boolean visitVariableOrParamDecl(ElemVariable elem) 88 { 89 return true; 90 } 91 92 /** 93 * Visit a LiteralResultElement. 94 * 95 * @param elem The literal result object. 96 * @return true if the sub expressions should be traversed. 97 */ 98 public boolean visitLiteralResultElement(ElemLiteralResult elem) 99 { 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 127