1 16 19 package org.apache.xalan.processor; 20 21 import javax.xml.transform.TransformerConfigurationException ; 22 import javax.xml.transform.TransformerException ; 23 24 import org.apache.xalan.templates.Stylesheet; 25 import org.apache.xalan.templates.StylesheetComposed; 26 import org.apache.xalan.templates.StylesheetRoot; 27 28 import org.xml.sax.Attributes ; 29 30 35 class ProcessorStylesheetElement extends XSLTElementProcessor 36 { 37 38 54 public void startElement( 55 StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) 56 throws org.xml.sax.SAXException 57 { 58 59 super.startElement(handler, uri, localName, rawName, attributes); 60 try 61 { 62 int stylesheetType = handler.getStylesheetType(); 63 Stylesheet stylesheet; 64 65 if (stylesheetType == StylesheetHandler.STYPE_ROOT) 66 { 67 try 68 { 69 stylesheet = new StylesheetRoot(handler.getSchema(), handler.getStylesheetProcessor().getErrorListener()); 70 } 71 catch(TransformerConfigurationException tfe) 72 { 73 throw new TransformerException (tfe); 74 } 75 } 76 else 77 { 78 Stylesheet parent = handler.getStylesheet(); 79 80 if (stylesheetType == StylesheetHandler.STYPE_IMPORT) 81 { 82 StylesheetComposed sc = new StylesheetComposed(parent); 83 84 parent.setImport(sc); 85 86 stylesheet = sc; 87 } 88 else 89 { 90 stylesheet = new Stylesheet(parent); 91 92 parent.setInclude(stylesheet); 93 } 94 } 95 96 stylesheet.setDOMBackPointer(handler.getOriginatingNode()); 97 stylesheet.setLocaterInfo(handler.getLocator()); 98 99 stylesheet.setPrefixes(handler.getNamespaceSupport()); 100 handler.pushStylesheet(stylesheet); 101 setPropertiesFromAttributes(handler, rawName, attributes, 102 handler.getStylesheet()); 103 handler.pushElemTemplateElement(handler.getStylesheet()); 104 } 105 catch(TransformerException te) 106 { 107 throw new org.xml.sax.SAXException (te); 108 } 109 } 110 111 122 public void endElement( 123 StylesheetHandler handler, String uri, String localName, String rawName) 124 throws org.xml.sax.SAXException 125 { 126 super.endElement(handler, uri, localName, rawName); 127 handler.popElemTemplateElement(); 128 handler.popStylesheet(); 129 } 130 } 131 | Popular Tags |