cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dles...@locus.apache.org
Subject cvs commit: xml-stylebook/src/org/apache/stylebook/processors Xalan2Processor.java
Date Wed, 15 Nov 2000 19:58:56 GMT
dleslie     00/11/15 11:58:56

  Modified:    src/org/apache/stylebook/processors Xalan2Processor.java
  Log:
  Updated to use new TrAX.
  
  Revision  Changes    Path
  1.3       +15 -16    xml-stylebook/src/org/apache/stylebook/processors/Xalan2Processor.java
  
  Index: Xalan2Processor.java
  ===================================================================
  RCS file: /home/cvs/xml-stylebook/src/org/apache/stylebook/processors/Xalan2Processor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Xalan2Processor.java	2000/10/13 21:26:20	1.2
  +++ Xalan2Processor.java	2000/11/15 19:58:56	1.3
  @@ -23,12 +23,13 @@
   import org.xml.sax.SAXException;
   
   // Imported TraX classes
  -import org.apache.trax.Templates;
  -import org.apache.trax.Transformer; 
  -import org.apache.trax.Result;
  -import org.apache.trax.ProcessorException; 
  -import org.apache.trax.ProcessorFactoryException;
  -import org.apache.trax.TransformException; 
  +import javax.xml.transform.TransformerFactory;
  +import javax.xml.transform.Transformer;
  +import javax.xml.transform.stream.StreamSource;
  +import javax.xml.transform.dom.DOMSource;
  +import javax.xml.transform.dom.DOMResult;
  +import javax.xml.transform.TransformerException; 
  +import javax.xml.transform.TransformerConfigurationException; 
   
   // Imported JAVA API for XML Parsing 1.0 classes
   import javax.xml.parsers.DocumentBuilder;
  @@ -51,24 +52,22 @@
               String styf=p.getParameter("stylesheet");
               if (null==styf) styf=this.getStyleSheet(doc);
               if (null==styf) return(doc);
  -			// Create processor, templates (StylesheetRoot) and transformer.
  -			org.apache.trax.Processor processor = org.apache.trax.Processor.newInstance("xslt");
  -            Templates templates = processor.process(new InputSource(styf));
  -            Transformer transformer = templates.newTransformer();
  +            TransformerFactory tFactory = TransformerFactory.newInstance();
  +            Transformer transformer = tFactory.newTransformer(new StreamSource(styf));
               // Set stylesheet parameters
               Enumeration enum=p.getParameterNames();
               while (enum.hasMoreElements()) {
                   String name=(String)enum.nextElement();
  -                transformer.setParameter(name, null, p.getParameter(name));
  -            }			
  -			// Set up DOM container for result.
  +                transformer.setParameter(name, p.getParameter(name));
  +            }
  +			      // Set up DOM container for result.
               DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
  -			dfactory.setNamespaceAware(true);
  +			      dfactory.setNamespaceAware(true);
               DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
               Document res = docBuilder.newDocument();
  -			// Perform the transformation.
  +			      // Perform the transformation.
               log("Applying XSL sheet \""+styf+"\"");
  - 	        transformer.transformNode(doc, new Result(res));
  + 	          transformer.transform(new DOMSource(doc), new DOMResult(res));
               return(res);
           } catch (Exception e) {
               e.printStackTrace(System.out);
  
  
  

Mime
View raw message