1 16 19 package org.apache.xalan.processor; 20 21 import org.apache.xalan.templates.ElemExsltFuncResult; 22 import org.apache.xalan.templates.ElemExsltFunction; 23 import org.apache.xalan.templates.ElemParam; 24 import org.apache.xalan.templates.ElemTemplateElement; 25 import org.apache.xalan.templates.ElemVariable; 26 27 import org.xml.sax.Attributes ; 28 import org.xml.sax.SAXException ; 29 30 34 public class ProcessorExsltFuncResult extends ProcessorTemplateElem 35 { 36 37 42 public void startElement( 43 StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) 44 throws SAXException 45 { 46 String msg = ""; 47 48 super.startElement(handler, uri, localName, rawName, attributes); 49 ElemTemplateElement ancestor = handler.getElemTemplateElement().getParentElem(); 50 while (ancestor != null && !(ancestor instanceof ElemExsltFunction)) 51 { 52 if (ancestor instanceof ElemVariable 53 || ancestor instanceof ElemParam 54 || ancestor instanceof ElemExsltFuncResult) 55 { 56 msg = "func:result cannot appear within a variable, parameter, or another func:result."; 57 handler.error(msg, new SAXException (msg)); 58 } 59 ancestor = ancestor.getParentElem(); 60 } 61 if (ancestor == null) 62 { 63 msg = "func:result must appear in a func:function element"; 64 handler.error(msg, new SAXException (msg)); 65 } 66 } 67 } 68 | Popular Tags |