sboag       00/11/03 15:28:18

  Modified:    java/src makexslt4j
               java/src/org/apache/xalan/client XSLTProcessorApplet.java
               java/src/org/apache/xalan/lib Extensions.java Redirect.java
               java/src/org/apache/xalan/processor
                        CompiledStylesheetBundle.java CompiledTemplate.java
                        CompilingStylesheetHandler.java
                        CompilingStylesheetProcessor.java
                        ProcessorImport.java ProcessorInclude.java
                        ProcessorKey.java ProcessorLRE.java
                        ProcessorNamespaceAlias.java
                        ProcessorOutputElem.java
                        ProcessorPreserveSpace.java
                        ProcessorStripSpace.java
                        ProcessorStylesheetElement.java
                        ProcessorTemplate.java StylesheetHandler.java
                        StylesheetPIHandler.java XSLTElementDef.java
               java/src/org/apache/xalan/res XSLTErrorResources.java
               java/src/org/apache/xalan/stree Parent.java
                        SourceTreeHandler.java
               java/src/org/apache/xalan/templates ElemCallTemplate.java
                        ElemExtensionDecl.java ElemForEach.java
                        ElemTemplate.java ElemTemplateElement.java
                        FuncDocument.java FuncFormatNumb.java
                        Stylesheet.java StylesheetComposed.java
                        StylesheetRoot.java
               java/src/org/apache/xalan/trace GenerateEvent.java
                        SelectionEvent.java TracerEvent.java
               java/src/org/apache/xalan/transformer MsgMgr.java
                        NodeSorter.java ResultTreeHandler.java
                        TransformState.java TransformerImpl.java
               java/src/org/apache/xalan/utils TreeWalker.java
               java/src/org/apache/xalan/xslt Process.java
               java/src/org/apache/xpath Expression.java
                        SourceTreeManager.java XPath.java XPathContext.java
                        XPathFactory.java
               java/src/org/apache/xpath/axes LocPathIterator.java
               java/src/org/apache/xpath/compiler Compiler.java
                        XPathParser.java
               java/src/org/apache/xpath/objects XNodeSet.java
               java/src/org/apache/xpath/res XPATHErrorResources.java
  Added:       java/src/org/apache/xalan/transformer TrAXFilter.java
               java/src/org/apache/xalan/utils SAXSourceLocator.java
  Log:
  TrAX (Transformations API for XML) changes.  The javax.xml.transform
  package is the reborn TrAX.  Significant changes were needed in
  the code because of the change of exception derivation and
  Locator change, and also because the structure has indeed changed
  a bit.  The code is still a little rough for the wear.  I'll work in the 
coming
  days to polish it up.  Internally, the code still uses Assaf's OutputFormat,
  but this should change to use the Properties bag.
  
  Revision  Changes    Path
  1.26      +32 -11    xml-xalan/java/src/makexslt4j
  
  Index: makexslt4j
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/makexslt4j,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- makexslt4j        2000/10/30 18:56:05     1.25
  +++ makexslt4j        2000/11/03 23:28:00     1.26
  @@ -27,6 +27,35 @@
   SUBDIRS = 
   
   SRCS = \
  +  javax$(PATHSEP)xml$(PATHSEP)parsers$(PATHSEP)DocumentBuilder.java \
  +  javax$(PATHSEP)xml$(PATHSEP)parsers$(PATHSEP)DocumentBuilderFactory.java \
  +  
javax$(PATHSEP)xml$(PATHSEP)parsers$(PATHSEP)FactoryConfigurationError.java \
  +  
javax$(PATHSEP)xml$(PATHSEP)parsers$(PATHSEP)ParserConfigurationException.java \
  +  javax$(PATHSEP)xml$(PATHSEP)parsers$(PATHSEP)SAXParser.java \
  +  javax$(PATHSEP)xml$(PATHSEP)parsers$(PATHSEP)SAXParserFactory.java \
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)Features.java \
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)Result.java \
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)Source.java \
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)SourceLocator.java \
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)Templates.java \
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)Transformer.java \
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)TransformerException.java \
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)TransformerFactory.java \
  +  
javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)TransformerConfigurationException.java
 \
  +  
javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)TFactoryConfigurationError.java \
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)URIResolver.java \
  +  
javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)dom$(PATHSEP)DOMLocator.java \
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)dom$(PATHSEP)DOMResult.java 
\
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)dom$(PATHSEP)DOMSource.java 
\
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)sax$(PATHSEP)SAXResult.java 
\
  +  javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)sax$(PATHSEP)SAXSource.java 
\
  +  
javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)sax$(PATHSEP)SAXTransformerFactory.java
 \
  +  
javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)sax$(PATHSEP)SerializerHandler.java
 \
  +  
javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)sax$(PATHSEP)TemplatesHandler.java
 \
  +  
javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)sax$(PATHSEP)TransformerHandler.java
 \
  +  
javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)stream$(PATHSEP)OutputKeys.java \
  +  
javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)stream$(PATHSEP)StreamResult.java
 \
  +  
javax$(PATHSEP)xml$(PATHSEP)transform$(PATHSEP)stream$(PATHSEP)StreamSource.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)client$(PATHSEP)XSLTProcessorApplet.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)extensions$(PATHSEP)ExtensionHandler.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)extensions$(PATHSEP)ExtensionHandlerGeneral.java
 \
  @@ -71,7 +100,7 @@
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)processor$(PATHSEP)CompilingStylesheetProcessor.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)processor$(PATHSEP)StylesheetHandler.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)processor$(PATHSEP)StylesheetPIHandler.java
 \
  -  
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)processor$(PATHSEP)StylesheetProcessor.java
 \
  +  
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)processor$(PATHSEP)TransformerFactoryImpl.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)processor$(PATHSEP)StopParseException.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)processor$(PATHSEP)TemplateElementFactory.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)processor$(PATHSEP)XSLProcessorVersion.java
 \
  @@ -199,6 +228,7 @@
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)transformer$(PATHSEP)ResultTreeHandler.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)transformer$(PATHSEP)StackGuard.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)transformer$(PATHSEP)TransformerImpl.java
 \
  +  
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)transformer$(PATHSEP)TrAXFilter.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)transformer$(PATHSEP)TransformState.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)transformer$(PATHSEP)TransformerClient.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)transformer$(PATHSEP)TreeWalker2Result.java
 \
  @@ -208,6 +238,7 @@
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)transformer$(PATHSEP)QueuedStartElement.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)transformer$(PATHSEP)QueuedEvents.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)transformer$(PATHSEP)SerializerSwitcher.java
 \
  +  
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)utils$(PATHSEP)SAXSourceLocator.java
 \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)utils$(PATHSEP)AttList.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)utils$(PATHSEP)BoolStack.java \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)utils$(PATHSEP)DefaultErrorHandler.java
 \
  @@ -242,16 +273,6 @@
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)utils$(PATHSEP)FastStringBuffer.java
 \
     
org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)utils$(PATHSEP)StringBufferPool.java
 \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)xslt$(PATHSEP)Process.java \
  -  org$(PATHSEP)apache$(PATHSEP)trax$(PATHSEP)Examples.java \
  -  org$(PATHSEP)apache$(PATHSEP)trax$(PATHSEP)Processor.java \
  -  org$(PATHSEP)apache$(PATHSEP)trax$(PATHSEP)ProcessorException.java \
  -  org$(PATHSEP)apache$(PATHSEP)trax$(PATHSEP)ProcessorFactoryException.java \
  -  org$(PATHSEP)apache$(PATHSEP)trax$(PATHSEP)Result.java \
  -  org$(PATHSEP)apache$(PATHSEP)trax$(PATHSEP)Templates.java \
  -  org$(PATHSEP)apache$(PATHSEP)trax$(PATHSEP)TemplatesBuilder.java \
  -  org$(PATHSEP)apache$(PATHSEP)trax$(PATHSEP)Transformer.java \
  -  org$(PATHSEP)apache$(PATHSEP)trax$(PATHSEP)TransformException.java \
  -  org$(PATHSEP)apache$(PATHSEP)trax$(PATHSEP)URIResolver.java \
     org$(PATHSEP)apache$(PATHSEP)serialize$(PATHSEP)DOMSerializer.java \
     org$(PATHSEP)apache$(PATHSEP)serialize$(PATHSEP)Method.java \
     org$(PATHSEP)apache$(PATHSEP)serialize$(PATHSEP)OutputFormat.java \
  
  
  
  1.7       +68 -53    
xml-xalan/java/src/org/apache/xalan/client/XSLTProcessorApplet.java
  
  Index: XSLTProcessorApplet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/client/XSLTProcessorApplet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XSLTProcessorApplet.java  2000/10/30 18:56:26     1.6
  +++ XSLTProcessorApplet.java  2000/11/03 23:28:01     1.7
  @@ -69,6 +69,8 @@
   import java.io.IOException;
   import java.io.InputStream;
   
  +import java.util.Properties;
  +
   // Needed Xalan classes
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xalan.res.XSLTErrorResources;
  @@ -76,13 +78,19 @@
   import org.apache.xalan.transformer.TransformerImpl;
   
   // Needed TRaX classes
  -import org.apache.trax.Result;
  -import org.apache.trax.Processor;
  -import org.apache.trax.ProcessorFactoryException;
  -import org.apache.trax.Transformer;
  -import org.apache.trax.TransformException;
  -import org.apache.trax.Templates;
  -import org.apache.trax.TemplatesBuilder;
  +import javax.xml.transform.Result;
  +import javax.xml.transform.TransformerFactory;
  +import javax.xml.transform.TransformerConfigurationException;
  +import javax.xml.transform.Transformer;
  +import javax.xml.transform.TransformerException;
  +import javax.xml.transform.Templates;
  +import javax.xml.transform.Source;
  +import javax.xml.transform.Result;
  +import javax.xml.transform.sax.TemplatesHandler;
  +import javax.xml.transform.sax.SAXTransformerFactory;
  +import javax.xml.transform.sax.TransformerHandler;
  +import javax.xml.transform.stream.StreamResult;
  +import javax.xml.transform.stream.StreamSource;
   
   // Needed SAX classes
   import org.xml.sax.InputSource;
  @@ -118,16 +126,16 @@
     /**
      * The stylesheet processor
      */
  -  Processor m_processor = null;
  +  SAXTransformerFactory m_tfactory = null;
   
     /** NEEDSDOC Field m_processorName          */
  -  String m_processorName = "org.apache.xalan.processor.StylesheetProcessor";
  +  String m_processorName = 
"org.apache.xalan.processor.TransformerFactoryImpl";
   
     /** NEEDSDOC Field m_reader          */
     XMLReader m_reader = null;
  -
  +  
     /** NEEDSDOC Field m_templatesBuilder          */
  -  TemplatesBuilder m_templatesBuilder = null;
  +  TemplatesHandler m_templatesBuilder = null;
   
     /**
      * @serial
  @@ -303,42 +311,42 @@
     protected void initLiaison(){}
   
     /**
  -   *  Obtain a new instance of a Stysheet Processor object
  +   *  Obtain a new instance of a Stysheet TransformerFactory object
      *  as specified by m_processorName.
  -   *  Workaround for Processor.newInstance() which an
  +   *  Workaround for TransformerFactory.newInstance() which an
      *  applet cannot use because it reads a system property.
  -   *  @return Concrete instance of an Processor object.
  +   *  @return Concrete instance of an TransformerFactory object.
      *
  -   * @throws ProcessorFactoryException
  +   * @throws TransformerConfigurationException
      */
  -  Processor newProcessorInstance() throws ProcessorFactoryException
  +  SAXTransformerFactory newProcessorInstance() throws 
TransformerConfigurationException
     {
   
  -    Processor m_processor = null;
  +    TransformerFactory tfactory = null;
   
       try
       {
         Class factoryClass = Class.forName(m_processorName);
   
  -      m_processor = (Processor) factoryClass.newInstance();
  +      tfactory = (TransformerFactory) factoryClass.newInstance();
       }
       catch (java.lang.IllegalAccessException iae)
       {
  -      throw new ProcessorFactoryException(
  -        "Transformation Processor can not be accessed!", iae);
  +      throw new TransformerConfigurationException(
  +        "Transformation TransformerFactory can not be accessed!", iae);
       }
       catch (java.lang.InstantiationException ie)
       {
  -      throw new ProcessorFactoryException(
  -        "Not able to create Transformation Processor!", ie);
  +      throw new TransformerConfigurationException(
  +        "Not able to create Transformation TransformerFactory!", ie);
       }
       catch (java.lang.ClassNotFoundException cnfe)
       {
  -      throw new ProcessorFactoryException(
  -        "Transformation Processor not found!", cnfe);
  +      throw new TransformerConfigurationException(
  +        "Transformation TransformerFactory not found!", cnfe);
       }
   
  -    return m_processor;
  +    return (SAXTransformerFactory)tfactory;
     }
   
     /**
  @@ -350,10 +358,10 @@
      *
      * @throws IOException
      * @throws SAXException
  -   * @throws TransformException
  +   * @throws TransformerException
      */
     void transform(TransformerImpl transformer, InputSource xmlSource)
  -          throws SAXException, TransformException, IOException
  +          throws SAXException, TransformerException, IOException
     {
   
       try
  @@ -390,11 +398,11 @@
       {
         se.printStackTrace();
   
  -      throw new TransformException(se);
  +      throw new TransformerException(se);
       }
       catch (IOException ioe)
       {
  -      throw new TransformException(ioe);
  +      throw new TransformerException(ioe);
       }
     }
   
  @@ -449,14 +457,15 @@
           "<?xml version='1.0'?><xsl:stylesheet 
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'><xsl:template 
match='foo'><out/></xsl:template></xsl:stylesheet>");
         PrintWriter pw = new PrintWriter(new StringWriter());
   
  -      m_processor = newProcessorInstance();
  +      m_tfactory = (SAXTransformerFactory)newProcessorInstance();
         m_reader = XMLReaderFactory.createXMLReader(
           "org.apache.xerces.parsers.SAXParser");
  -      m_templatesBuilder = m_processor.getTemplatesBuilder();
  +      
  +      m_templatesBuilder = m_tfactory.newTemplatesHandler();
   
         m_reader.setContentHandler(m_templatesBuilder);
   
  -      synchronized (m_processor)
  +      synchronized (m_tfactory)
         {
           m_reader.parse(new InputSource(xslbuf));
   
  @@ -465,18 +474,16 @@
             (TransformerImpl) templates.newTransformer();
   
           // Result result = new Result(pw);
  -        Serializer serializer =
  -          SerializerFactory.getSerializer(templates.getOutputFormat());
  +        TransformerHandler serializer =
  +          m_tfactory.newTransformerHandler();
   
           // org.apache.serialize.Serializer serializer = new 
org.apache.xml.serialize.transition.HTMLSerializer();
           // org.apache.serialize.Serializer serializer = 
org.apache.serialize.SerializerFactory.getSerializer( "HTML" );
  -        serializer.setWriter(pw);
  -
  -        org.xml.sax.ContentHandler handler = serializer.asContentHandler();
  +        serializer.setResult(new StreamResult(pw));
   
           // new org.apache.xml.org.apache.serialize.HTMLSerializer(pw, new 
OutputFormat()).asContentHandler();
  -        transformer.setContentHandler(handler);
  -        transformer.setParent(m_reader);
  +        transformer.setContentHandler(serializer);
  +        // transformer.setParent(m_reader);
           transform(transformer, new InputSource(xmlbuf));
           this.showStatus("PRIMED the pump!");
         }
  @@ -576,7 +583,7 @@
      *
      * NEEDSDOC @param key
      * @param expr The parameter expression to be submitted.
  -   * @see org.apache.xalan.xslt.Processor#setStylesheetParam(String, String)
  +   * @see 
org.apache.xalan.xslt.TransformerFactory#setStylesheetParam(String, String)
      */
     public void setStylesheetParam(String key, String expr)
     {
  @@ -819,7 +826,7 @@
      *
      * @throws SAXException
      */
  -  private String doTransformation(Processor processor) throws SAXException
  +  private String doTransformation(TransformerFactory processor) throws 
SAXException
     {
   
       URL documentURL = null;
  @@ -831,7 +838,7 @@
   
       try
       {
  -      m_templatesBuilder = m_processor.getTemplatesBuilder();
  +      m_templatesBuilder = m_tfactory.newTemplatesHandler();
   
         m_reader.setContentHandler(m_templatesBuilder);
   
  @@ -855,17 +862,25 @@
         // Result result = new Result(pw);
         // org.apache.serialize.Serializer serializer = new 
org.apache.xml.serialize.transition.HTMLSerializer(); 
this.showStatus("serializer is "+ serializer);
         //org.apache.serialize.Serializer serializer = 
org.apache.serialize.SerializerFactory.getSerializer( "HTML" );
  -      Serializer serializer =
  -        SerializerFactory.getSerializer(templates.getOutputFormat());
  +      TransformerHandler serializer =
  +        m_tfactory.newTransformerHandler();
  +      
  +      serializer.setResult(new StreamResult(pw));
   
  -      serializer.setWriter(pw);
  -
  -      org.xml.sax.ContentHandler handler = serializer.asContentHandler();
  -
  -      transformer.setContentHandler(handler);
  -      transformer.setParent(m_reader);
  +      transformer.setContentHandler(serializer);
  +      // transformer.setParent(m_reader);
         transform(transformer, xmlSource);
       }
  +    catch (TransformerException tfe)
  +    {
  +      tfe.printStackTrace();
  +      System.exit(-1);
  +    }
  +    catch (TransformerConfigurationException tfe)
  +    {
  +      tfe.printStackTrace();
  +      System.exit(-1);
  +    }
       catch (MalformedURLException e)
       {
         e.printStackTrace();
  @@ -904,11 +919,11 @@
           this.showStatus(
             "Waiting for Xalan and Xerces to finish loading and JITing...");
   
  -        synchronized (m_processor)
  +        synchronized (m_tfactory)
           {
   
             // TransformerImpl processor = new XSLProcessor(m_liaison);
  -          htmlData = doTransformation(m_processor);
  +          htmlData = doTransformation(m_tfactory);
           }
         }
         else
  @@ -918,7 +933,7 @@
       }
       catch (NoClassDefFoundError e)
       {
  -      System.out.println("Can not find " + whichParser + " XML Processor!!");
  +      System.out.println("Can not find " + whichParser + " XML 
TransformerFactory!!");
       }
   
       return htmlData;
  
  
  
  1.5       +1 -1      xml-xalan/java/src/org/apache/xalan/lib/Extensions.java
  
  Index: Extensions.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/Extensions.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Extensions.java   2000/10/29 18:25:25     1.4
  +++ Extensions.java   2000/11/03 23:28:01     1.5
  @@ -143,7 +143,7 @@
        {
                NodeSet ns1 = new NodeSet(ni1);
                NodeSet ns2 = new NodeSet(ni2);
  -             NodeSet inter= new NodeSet();
  +             // NodeSet inter= new NodeSet();
                NodeSet diff = new NodeSet();
                diff.setShouldCacheNodes(true);         
                for (int i = 0; i < ns1.getLength(); i++)
  
  
  
  1.8       +20 -8     xml-xalan/java/src/org/apache/xalan/lib/Redirect.java
  
  Index: Redirect.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/Redirect.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Redirect.java     2000/10/23 21:12:04     1.7
  +++ Redirect.java     2000/11/03 23:28:01     1.8
  @@ -59,7 +59,9 @@
   import java.util.*;
   import java.io.*;
   import java.net.URL;
  +
   import org.xml.sax.ContentHandler;
  +
   import org.apache.serialize.OutputFormat;
   import org.apache.xalan.extensions.XSLProcessorContext;
   import org.apache.xalan.transformer.TransformerImpl;
  @@ -69,6 +71,9 @@
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.XPath;
   
  +import javax.xml.transform.stream.StreamResult;
  +import javax.xml.transform.TransformerException;
  +
   /**
    * Implements three extension elements to allow an XSLT transformation to
    * redirect its output to multiple output files.
  @@ -359,15 +364,22 @@
   
       FileOutputStream ostream = new FileOutputStream(file);
       
  -    ContentHandler flistener 
  -      = transformer.createResultContentHandler(new 
org.apache.trax.Result(ostream), format);
  -
  -    flistener.startDocument();
  -    if(shouldPutInTable)
  +    try
       {
  -      m_outputStreams.put(fileName, ostream);
  -      m_formatterListeners.put(fileName, flistener);
  +      ContentHandler flistener 
  +        = transformer.createResultContentHandler(new StreamResult(ostream), 
format);
  +      flistener.startDocument();
  +      if(shouldPutInTable)
  +      {
  +        m_outputStreams.put(fileName, ostream);
  +        m_formatterListeners.put(fileName, flistener);
  +      }
  +      return flistener;
  +    }
  +    catch(TransformerException te)
  +    {
  +      throw new org.xml.sax.SAXException(te);
       }
  -    return flistener;
  +    
     }
   }
  
  
  
  1.8       +6 -7      
xml-xalan/java/src/org/apache/xalan/processor/CompiledStylesheetBundle.java
  
  Index: CompiledStylesheetBundle.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/CompiledStylesheetBundle.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CompiledStylesheetBundle.java     2000/10/27 16:59:40     1.7
  +++ CompiledStylesheetBundle.java     2000/11/03 23:28:02     1.8
  @@ -70,10 +70,9 @@
   import org.apache.xalan.templates.StylesheetRoot;
   import org.apache.xalan.templates.Stylesheet;
   import org.apache.xalan.templates.XMLNSDecl;
  -import org.apache.trax.ProcessorException;
  -import org.apache.trax.TemplatesBuilder;
  -import org.apache.trax.Templates;
  -import org.apache.trax.TransformException;
  +import javax.xml.transform.TransformerConfigurationException;
  +import javax.xml.transform.Templates;
  +import javax.xml.transform.TransformerException;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathFactory;
   import org.apache.xpath.compiler.XPathParser;
  @@ -292,12 +291,12 @@
        * Xalan code was changed between when the bundle was created and when it
        * is being reloaded.
        */
  -     public org.apache.trax.Templates loadBundle(String filename)
  +     public javax.xml.transform.Templates loadBundle(String filename)
                throws java.io.IOException,java.lang.ClassNotFoundException
        {
                java.io.InputStream is=null;
                java.io.ObjectInputStream os=null;
  -             org.apache.trax.Templates ss=null;
  +             javax.xml.transform.Templates ss=null;
                
                try
                {
  @@ -308,7 +307,7 @@
                        is=cl.getResourceAsStream("Stylesheet.ser");
                        // Read objects from the .ser, loading from bundle if 
necessary
                        os=new ClassLoaderObjectInputStream(cl,is);
  -                     ss=(org.apache.trax.Templates)os.readObject();
  +                     ss=(javax.xml.transform.Templates)os.readObject();
                }
                finally
                {
  
  
  
  1.6       +4 -2      
xml-xalan/java/src/org/apache/xalan/processor/CompiledTemplate.java
  
  Index: CompiledTemplate.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/CompiledTemplate.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CompiledTemplate.java     2000/10/25 15:06:29     1.5
  +++ CompiledTemplate.java     2000/11/03 23:28:02     1.6
  @@ -63,6 +63,9 @@
   package org.apache.xalan.processor;
   import org.apache.xalan.templates.ElemTemplate;
   
  +import javax.xml.transform.SourceLocator;
  +import org.apache.xalan.utils.SAXSourceLocator;
  +
   public abstract class CompiledTemplate
   extends ElemTemplate 
   implements java.io.Serializable
  @@ -121,8 +124,7 @@
                          String publicId,String systemId,
                          java.lang.Object[] interpretArray)
     {
  -    org.xml.sax.helpers.LocatorImpl locator=
  -      new org.xml.sax.helpers.LocatorImpl();
  +    SAXSourceLocator locator = new SAXSourceLocator();
       locator.setLineNumber(lineNumber);
       locator.setColumnNumber(columnNumber);
       locator.setPublicId(publicId);
  
  
  
  1.14      +7 -8      
xml-xalan/java/src/org/apache/xalan/processor/CompilingStylesheetHandler.java
  
  Index: CompilingStylesheetHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/CompilingStylesheetHandler.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- CompilingStylesheetHandler.java   2000/10/27 16:59:40     1.13
  +++ CompilingStylesheetHandler.java   2000/11/03 23:28:02     1.14
  @@ -70,10 +70,9 @@
   import org.apache.xalan.templates.StylesheetRoot;
   import org.apache.xalan.templates.Stylesheet;
   import org.apache.xalan.templates.XMLNSDecl;
  -import org.apache.trax.ProcessorException;
  -import org.apache.trax.TemplatesBuilder;
  -import org.apache.trax.Templates;
  -import org.apache.trax.TransformException;
  +import javax.xml.transform.TransformerConfigurationException;
  +import javax.xml.transform.Templates;
  +import javax.xml.transform.TransformerException;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathFactory;
   import org.apache.xpath.compiler.XPathParser;
  @@ -113,11 +112,11 @@
     /**
      * Create a StylesheetHandler object, creating a root stylesheet 
      * as the target.
  -   * @exception May throw ProcessorException if a StylesheetRoot 
  +   * @exception May throw TransformerConfigurationException if a 
StylesheetRoot 
      * can not be constructed for some reason.
      */
  -  public CompilingStylesheetHandler(StylesheetProcessor processor)
  -    throws ProcessorException
  +  public CompilingStylesheetHandler(TransformerFactoryImpl processor)
  +    throws TransformerConfigurationException
     {
       super(processor);
     }
  @@ -830,7 +829,7 @@
           +"// so all the variables can be popped at once when we're done.\n"
           +"org.apache.xpath.VariableStack "+varstackName+" = 
transformer.getXPathContext().getVarStack();\n"
           +varstackName+".pushElemFrame();\n"
  -        +"org.xml.sax.Locator "+savedLocatorName+" = 
xctxt.getSAXLocator();\n"
  +        +"SourceLocator "+savedLocatorName+" = xctxt.getSAXLocator();\n"
           );
   
         body.append("try {\n\n");
  
  
  
  1.4       +12 -12    
xml-xalan/java/src/org/apache/xalan/processor/CompilingStylesheetProcessor.java
  
  Index: CompilingStylesheetProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/CompilingStylesheetProcessor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CompilingStylesheetProcessor.java 2000/10/30 18:40:35     1.3
  +++ CompilingStylesheetProcessor.java 2000/11/03 23:28:02     1.4
  @@ -65,18 +65,18 @@
   
   import org.w3c.dom.Node;
   
  -import org.apache.trax.Processor;
  -import org.apache.trax.ProcessorException;
  -import org.apache.trax.Templates;
  -import org.apache.trax.TemplatesBuilder;
  +import javax.xml.transform.TransformerFactory;
  +import javax.xml.transform.TransformerConfigurationException;
  +import javax.xml.transform.Templates;
  +import javax.xml.transform.sax.TemplatesHandler;
   
   /**
  - * The StylesheetProcessor, which implements the TRaX Processor
  + * The TransformerFactoryImpl, which implements the TRaX TransformerFactory
    * interface, processes XSLT Stylesheets into a Templates object.
    * This version has been modified to kick off conversion to JAVA,
    * via CompilingStylesheetHandler
    */
  -public class CompilingStylesheetProcessor extends StylesheetProcessor
  +public class CompilingStylesheetProcessor extends TransformerFactoryImpl
   {
   
     /**
  @@ -86,17 +86,17 @@
      *
      * <h3>Open issues:</h3>
      * <dl>
  -   *    <dt><h4>Should Processor derive from 
org.xml.sax.ContentHandler?</h4></dt>
  -   *    <dd>Instead of requesting an object from the Processor class, should
  -   *        the Processor class simply derive from 
org.xml.sax.ContentHandler?</dd>
  +   *    <dt><h4>Should TransformerFactory derive from 
org.xml.sax.ContentHandler?</h4></dt>
  +   *    <dd>Instead of requesting an object from the TransformerFactory 
class, should
  +   *        the TransformerFactory class simply derive from 
org.xml.sax.ContentHandler?</dd>
      * </dl>
      * @return A TemplatesBuilder object, or null if not supported.
  -   * @exception May throw a ProcessorException if a StylesheetHandler can
  +   * @exception May throw a TransformerConfigurationException if a 
StylesheetHandler can
      * not be constructed for some reason.
      *
  -   * @throws ProcessorException
  +   * @throws TransformerConfigurationException
      */
  -  public TemplatesBuilder getTemplatesBuilder() throws ProcessorException
  +  public TemplatesHandler newTemplatesHandler() throws 
TransformerConfigurationException
     {
       return new CompilingStylesheetHandler(this);
     }
  
  
  
  1.6       +1 -1      
xml-xalan/java/src/org/apache/xalan/processor/ProcessorImport.java
  
  Index: ProcessorImport.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorImport.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ProcessorImport.java      2000/10/30 18:40:37     1.5
  +++ ProcessorImport.java      2000/11/03 23:28:02     1.6
  @@ -73,7 +73,7 @@
   
   import java.io.IOException;
   
  -import org.apache.trax.URIResolver;
  +import javax.xml.transform.URIResolver;
   
   import org.w3c.dom.Node;
   
  
  
  
  1.8       +43 -56    
xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java
  
  Index: ProcessorInclude.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ProcessorInclude.java     2000/10/30 18:40:37     1.7
  +++ ProcessorInclude.java     2000/11/03 23:28:02     1.8
  @@ -73,14 +73,20 @@
   
   import org.xml.sax.helpers.XMLReaderFactory;
   
  -import org.apache.trax.URIResolver;
  +import javax.xml.transform.URIResolver;
  +import javax.xml.transform.stream.StreamSource;
  +import javax.xml.transform.dom.DOMSource;
  +import javax.xml.transform.sax.SAXSource;
  +import javax.xml.transform.stream.StreamSource;
  +import javax.xml.transform.Source;
  +import javax.xml.transform.TransformerException;
   
   import org.w3c.dom.Node;
   
   import org.apache.xalan.utils.SystemIDResolver;
   
   /**
  - * Processor class for xsl:include markup.
  + * TransformerFactory class for xsl:include markup.
    * @see <a href="http://www.w3.org/TR/xslt#dtd";>XSLT DTD</a>
    * @see <a href="http://www.w3.org/TR/xslt#include";>include in XSLT 
Specification</a>
    */
  @@ -180,70 +186,59 @@
             StylesheetHandler handler, String uri, String localName, String 
rawName, Attributes attributes)
               throws SAXException
     {
  +    TransformerFactoryImpl processor = handler.getStylesheetProcessor();
  +    URIResolver uriresolver = processor.getURIResolver();
   
  -    URIResolver uriresolver =
  -      handler.getStylesheetProcessor().getURIResolver();
  -
       try
       {
  -      XMLReader reader = null;
  -      boolean tryCreatingReader = true;
  -      EntityResolver entityResolver =
  -        handler.getStylesheetProcessor().getEntityResolver();
  -      InputSource inputSource;
  +      Source source = null;
   
  -      if (null != entityResolver)
  +      if (null != uriresolver)
         {
  -        inputSource = entityResolver.resolveEntity(null, getHref());
  +        try
  +        {
  +          source = uriresolver.resolve(getHref(),
  +                                       handler.getBaseIdentifier());
  +        }
  +        catch(TransformerException te)
  +        {
  +          handler.error("Error with URI Resolver!", te);
  +        }
   
  -        // TODO: Check for relative URL, and absolutize it???  Or no?
  +        if (null != source && source instanceof DOMSource)
  +        {
  +          Node node = ((DOMSource)source).getNode();
  +          TreeWalker walker = new TreeWalker(handler);
  +
  +          walker.traverse(node);
  +          return;
  +        }
         }
  -      else
  +      
  +      if(null == source)
         {
           String absURL = SystemIDResolver.getAbsoluteURI(getHref(),
                             handler.getBaseIdentifier());
   
  -        inputSource = new InputSource(absURL);
  +        source = new StreamSource(absURL);
         }
  -
  -      if (null != uriresolver)
  +      
  +      XMLReader reader = null;
  +      
  +      if(source instanceof SAXSource)
         {
  -        tryCreatingReader = false;
  -        reader = uriresolver.getXMLReader(inputSource);
  -
  -        if (null == reader)
  -        {
  -          Node node = uriresolver.getDOMNode(inputSource);
  -
  -          if (null != node)
  -          {
  -            TreeWalker walker = new TreeWalker(handler);
  -
  -            walker.traverse(node);
  -          }
  -          else
  -            tryCreatingReader = true;
  -        }
  +        SAXSource saxSource = (SAXSource)source;
  +        reader = saxSource.getXMLReader(); // may be null
         }
  -
  -      if (tryCreatingReader)
  -      {
  -        reader = handler.getStylesheetProcessor().getXMLReader();
  +      
  +      InputSource inputSource = SAXSource.sourceToInputSource(source);
   
  -        if (null == reader)
  -        {
  -          reader = XMLReaderFactory.createXMLReader();
  -        }
  -        else
  -        {
  -          Class readerClass = ((Object) reader).getClass();
  +      if (null == reader)
  +        reader = XMLReaderFactory.createXMLReader();
   
  -          reader = (XMLReader) readerClass.newInstance();
  -        }
  -      }
  -
         if (null != reader)
         {
  +        EntityResolver entityResolver = processor.getEntityResolver();
           if (null != entityResolver)
             reader.setEntityResolver(entityResolver);
   
  @@ -261,14 +256,6 @@
             handler.popBaseIndentifier();
           }
         }
  -    }
  -    catch (InstantiationException ie)
  -    {
  -      handler.error("Could not clone parser!", ie);
  -    }
  -    catch (IllegalAccessException iae)
  -    {
  -      handler.error("Can not access class!", iae);
       }
       catch (IOException ioe)
       {
  
  
  
  1.6       +1 -1      
xml-xalan/java/src/org/apache/xalan/processor/ProcessorKey.java
  
  Index: ProcessorKey.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorKey.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ProcessorKey.java 2000/10/30 18:40:38     1.5
  +++ ProcessorKey.java 2000/11/03 23:28:02     1.6
  @@ -67,7 +67,7 @@
   import java.util.Vector;
   
   /**
  - * Processor for xsl:key markup.
  + * TransformerFactory for xsl:key markup.
    * <pre>
    * <!ELEMENT xsl:key EMPTY>
    * <!ATTLIST xsl:key
  
  
  
  1.10      +13 -2     
xml-xalan/java/src/org/apache/xalan/processor/ProcessorLRE.java
  
  Index: ProcessorLRE.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorLRE.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ProcessorLRE.java 2000/10/30 18:40:38     1.9
  +++ ProcessorLRE.java 2000/11/03 23:28:03     1.10
  @@ -69,6 +69,9 @@
   import org.xml.sax.Attributes;
   import org.xml.sax.helpers.AttributesImpl;
   
  +import javax.xml.transform.TransformerConfigurationException;
  +import org.apache.xalan.utils.SAXSourceLocator;
  +
   /**
    * <meta name="usage" content="internal"/>
    * NEEDSDOC Class ProcessorLRE <needs-comment/>
  @@ -112,11 +115,19 @@
   
         handler.pushProcessor(lreProcessor);
   
  -      Stylesheet stylesheet = new StylesheetRoot();
  +      Stylesheet stylesheet;
  +      try
  +      {
  +        stylesheet = new StylesheetRoot();
  +      }
  +      catch(TransformerConfigurationException tfe)
  +      {
  +        throw new SAXException(tfe);
  +      }
   
         // stylesheet.setDOMBackPointer(handler.getOriginatingNode());
          // ***** Note that we're assigning an empty locator. Is this 
necessary?
  -      stylesheet.setLocaterInfo(new org.xml.sax.helpers.LocatorImpl());
  +      stylesheet.setLocaterInfo(new SAXSourceLocator());
         stylesheet.setPrefixes(handler.getNamespaceSupport());
         handler.pushStylesheet(stylesheet);
   
  
  
  
  1.3       +1 -1      
xml-xalan/java/src/org/apache/xalan/processor/ProcessorNamespaceAlias.java
  
  Index: ProcessorNamespaceAlias.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorNamespaceAlias.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProcessorNamespaceAlias.java      2000/10/30 18:40:39     1.2
  +++ ProcessorNamespaceAlias.java      2000/11/03 23:28:03     1.3
  @@ -62,7 +62,7 @@
   import org.xml.sax.Attributes;
   
   /**
  - * Processor for xsl:namespace-alias markup.
  + * TransformerFactory for xsl:namespace-alias markup.
    * A stylesheet can use the xsl:namespace-alias element to
    * declare that one namespace URI is an alias for another namespace URI.
    * <pre>
  
  
  
  1.5       +1 -1      
xml-xalan/java/src/org/apache/xalan/processor/ProcessorOutputElem.java
  
  Index: ProcessorOutputElem.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorOutputElem.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProcessorOutputElem.java  2000/10/30 18:40:39     1.4
  +++ ProcessorOutputElem.java  2000/11/03 23:28:03     1.5
  @@ -68,7 +68,7 @@
   import org.xml.sax.Attributes;
   
   /**
  - * Processor for xsl:output markup.
  + * TransformerFactory for xsl:output markup.
    * @see <a href="http://www.w3.org/TR/xslt#dtd";>XSLT DTD</a>
    * @see <a href="http://www.w3.org/TR/xslt#output";>output in XSLT 
Specification</a>
    */
  
  
  
  1.3       +1 -1      
xml-xalan/java/src/org/apache/xalan/processor/ProcessorPreserveSpace.java
  
  Index: ProcessorPreserveSpace.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorPreserveSpace.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProcessorPreserveSpace.java       2000/10/30 18:40:39     1.2
  +++ ProcessorPreserveSpace.java       2000/11/03 23:28:03     1.3
  @@ -62,7 +62,7 @@
   import java.util.Vector;
   
   /**
  - * Processor for xsl:preserve-space markup.
  + * TransformerFactory for xsl:preserve-space markup.
    * <pre>
    * <!ELEMENT xsl:preserve-space EMPTY>
    * <!ATTLIST xsl:preserve-space elements CDATA #REQUIRED>
  
  
  
  1.3       +1 -1      
xml-xalan/java/src/org/apache/xalan/processor/ProcessorStripSpace.java
  
  Index: ProcessorStripSpace.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorStripSpace.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProcessorStripSpace.java  2000/10/30 18:40:39     1.2
  +++ ProcessorStripSpace.java  2000/11/03 23:28:03     1.3
  @@ -62,7 +62,7 @@
   import java.util.Vector;
   
   /**
  - * Processor for xsl:strip-space markup.
  + * TransformerFactory for xsl:strip-space markup.
    * <pre>
    * <!ELEMENT xsl:strip-space EMPTY>
    * <!ATTLIST xsl:strip-space elements CDATA #REQUIRED>
  
  
  
  1.4       +11 -2     
xml-xalan/java/src/org/apache/xalan/processor/ProcessorStylesheetElement.java
  
  Index: ProcessorStylesheetElement.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorStylesheetElement.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProcessorStylesheetElement.java   2000/10/30 18:40:40     1.3
  +++ ProcessorStylesheetElement.java   2000/11/03 23:28:03     1.4
  @@ -63,8 +63,10 @@
   import org.xml.sax.SAXException;
   import org.xml.sax.Attributes;
   
  +import javax.xml.transform.TransformerConfigurationException;
  +
   /**
  - * Processor for xsl:stylesheet or xsl:transform markup.
  + * TransformerFactory for xsl:stylesheet or xsl:transform markup.
    * @see <a href="http://www.w3.org/TR/xslt#dtd";>XSLT DTD</a>
    * @see <a 
href="http://www.w3.org/TR/xslt#stylesheet-element";>stylesheet-element in XSLT 
Specification</a>
    */
  @@ -107,7 +109,14 @@
   
       if (stylesheetType == StylesheetHandler.STYPE_ROOT)
       {
  -      stylesheet = new StylesheetRoot();
  +      try
  +      {
  +        stylesheet = new StylesheetRoot();
  +      }
  +      catch(TransformerConfigurationException tfe)
  +      {
  +        throw new SAXException(tfe);
  +      }
       }
       else
       {
  
  
  
  1.4       +1 -1      
xml-xalan/java/src/org/apache/xalan/processor/ProcessorTemplate.java
  
  Index: ProcessorTemplate.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorTemplate.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProcessorTemplate.java    2000/10/30 18:40:40     1.3
  +++ ProcessorTemplate.java    2000/11/03 23:28:03     1.4
  @@ -63,7 +63,7 @@
   import org.xml.sax.Attributes;
   
   /**
  - * Processor for xsl:template markup.
  + * TransformerFactory for xsl:template markup.
    */
   class ProcessorTemplate extends ProcessorTemplateElem
   {
  
  
  
  1.15      +48 -39    
xml-xalan/java/src/org/apache/xalan/processor/StylesheetHandler.java
  
  Index: StylesheetHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/StylesheetHandler.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StylesheetHandler.java    2000/10/30 18:40:42     1.14
  +++ StylesheetHandler.java    2000/11/03 23:28:03     1.15
  @@ -58,40 +58,51 @@
   
   import java.net.URL;
   
  +import javax.xml.transform.sax.TemplatesHandler;
  +import javax.xml.transform.Templates;
  +import javax.xml.transform.TransformerException;
  +import javax.xml.transform.TransformerConfigurationException;
  +
   import java.util.Stack;
   
  +import org.apache.xalan.res.XSLMessages;
  +
   import org.apache.xalan.templates.Constants;
   import org.apache.xalan.templates.ElemTemplateElement;
  +import org.apache.xalan.templates.ElemUnknown;
   import org.apache.xalan.templates.StylesheetRoot;
   import org.apache.xalan.templates.Stylesheet;
  -import org.apache.xalan.templates.ElemUnknown;
  +
   import org.apache.xalan.utils.NodeConsumer;
  +import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xalan.utils.XMLCharacterRecognizer;
  -import org.apache.trax.ProcessorException;
  -import org.apache.trax.TemplatesBuilder;
  -import org.apache.trax.Templates;
  -import org.apache.trax.TransformException;
  -import org.apache.xpath.XPath;
  -import org.apache.xpath.XPathFactory;
  -import org.apache.xpath.compiler.XPathParser;
  +
   import org.apache.xpath.compiler.FunctionTable;
  +import org.apache.xpath.compiler.XPathParser;
  +
   import org.apache.xpath.functions.Function;
  -import org.apache.xalan.res.XSLMessages;
  -import org.apache.xalan.utils.PrefixResolver;
   
  +import org.apache.xpath.XPathFactory;
  +import org.apache.xpath.XPath;
  +
  +import org.w3c.dom.Node;
  +
   import org.xml.sax.Attributes;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.DTDHandler;
   import org.xml.sax.EntityResolver;
   import org.xml.sax.ErrorHandler;
   import org.xml.sax.ErrorHandler;
  -import org.xml.sax.helpers.NamespaceSupport;
   import org.xml.sax.InputSource;
   import org.xml.sax.Locator;
   import org.xml.sax.SAXException;
   import org.xml.sax.SAXParseException;
   
  -import org.w3c.dom.Node;
  +import org.xml.sax.helpers.NamespaceSupport;
  +import org.xml.sax.helpers.DefaultHandler;
  +
  +import javax.xml.transform.SourceLocator;
  +import org.apache.xalan.utils.SAXSourceLocator;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -100,9 +111,8 @@
    * a ContentHandler stack, and pushing appropriate content
    * handlers as parse events occur.
    */
  -public class StylesheetHandler
  -        implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler,
  -                   TemplatesBuilder, PrefixResolver, NodeConsumer
  +public class StylesheetHandler extends DefaultHandler
  +        implements TemplatesHandler, PrefixResolver, NodeConsumer
   {
   
     /**
  @@ -110,13 +120,13 @@
      * as the target.
      *
      * NEEDSDOC @param processor
  -   * @exception May throw ProcessorException if a StylesheetRoot
  +   * @exception May throw TransformerConfigurationException if a 
StylesheetRoot
      * can not be constructed for some reason.
      *
  -   * @throws ProcessorException
  +   * @throws TransformerConfigurationException
      */
  -  public StylesheetHandler(StylesheetProcessor processor)
  -          throws ProcessorException
  +  public StylesheetHandler(TransformerFactoryImpl processor)
  +          throws TransformerConfigurationException
     {
   
       // m_schema = new XSLTSchema();
  @@ -134,7 +144,7 @@
      *
      * NEEDSDOC @param processor
      */
  -  void init(StylesheetProcessor processor)
  +  void init(TransformerFactoryImpl processor)
     {
   
       // Not sure about double-check of this flag, but 
  @@ -239,7 +249,7 @@
     public String getBaseIdentifier()
     {
   
  -    org.xml.sax.Locator locator = getLocator();
  +    SourceLocator locator = getLocator();
   
       return (null == locator) ? "" : locator.getSystemId();
     }
  @@ -288,9 +298,9 @@
      * @version Alpha
      * @author <a href="mailto:[EMAIL PROTECTED]">Scott Boag</a>
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public Templates getTemplates() throws TransformException
  +  public Templates getTemplates()
     {
       return getStylesheetRoot();
     }
  @@ -418,7 +428,7 @@
      * Receive a Locator object for document events.
      * This is called by the parser to push a locator for the
      * stylesheet being parsed. The stack needs to be popped
  -   * after the stylesheed has been parsed. We pop in in
  +   * after the stylesheed has been parsed. We pop in
      * popStylesheet.
      *
      * @param locator A locator for all SAX document events.
  @@ -429,7 +439,7 @@
     {
   
       // System.out.println("pushing locator for: "+locator.getSystemId());
  -    m_stylesheetLocatorStack.push(locator);
  +    m_stylesheetLocatorStack.push(new SAXSourceLocator(locator));
     }
   
     /**
  @@ -746,11 +756,11 @@
     {
   
       String formattedMsg = m_XSLMessages.createWarning(msg, args);
  -    Locator locator = getLocator();
  +    SAXSourceLocator locator = getLocator();
       ErrorHandler handler = m_stylesheetProcessor.getErrorHandler();
   
       if (null != handler)
  -      handler.warning(new ProcessorException(formattedMsg, locator));
  +      handler.warning(new SAXParseException(formattedMsg, locator));
     }
   
     /**
  @@ -782,11 +792,11 @@
     protected void error(String msg, Exception e) throws SAXException
     {
   
  -    Locator locator = getLocator();
  +    SAXSourceLocator locator = getLocator();
       ErrorHandler handler = m_stylesheetProcessor.getErrorHandler();
  -    ProcessorException pe = (null == e)
  -                            ? new ProcessorException(msg, locator)
  -                            : new ProcessorException(msg, locator, e);
  +    SAXParseException pe = (null == e)
  +                            ? new SAXParseException(msg, locator)
  +                            : new SAXParseException(msg, locator, e);
   
       if (null != handler)
         handler.fatalError(pe);
  @@ -947,16 +957,16 @@
     }
   
     /**
  -   *  The XSLT Processor for needed services.
  +   *  The XSLT TransformerFactory for needed services.
      */
  -  private StylesheetProcessor m_stylesheetProcessor;
  +  private TransformerFactoryImpl m_stylesheetProcessor;
   
     /**
  -   * Get the XSLT Processor for needed services.
  +   * Get the XSLT TransformerFactory for needed services.
      *
      * NEEDSDOC ($objectName$) @return
      */
  -  StylesheetProcessor getStylesheetProcessor()
  +  TransformerFactoryImpl getStylesheetProcessor()
     {
       return m_stylesheetProcessor;
     }
  @@ -1236,19 +1246,18 @@
      *
      * NEEDSDOC ($objectName$) @return
      */
  -  public Locator getLocator()
  +  public SAXSourceLocator getLocator()
     {
   
       if (m_stylesheetLocatorStack.isEmpty())
       {
  -      org.xml.sax.helpers.LocatorImpl locator =
  -        new org.xml.sax.helpers.LocatorImpl();
  +      SAXSourceLocator locator = new SAXSourceLocator();
   
         locator.setSystemId(this.getStylesheetProcessor().getDOMsystemID());
         m_stylesheetLocatorStack.push(locator);
       }
   
  -    return ((Locator) m_stylesheetLocatorStack.peek());
  +    return ((SAXSourceLocator) m_stylesheetLocatorStack.peek());
     }
   
     /**
  
  
  
  1.4       +12 -15    
xml-xalan/java/src/org/apache/xalan/processor/StylesheetPIHandler.java
  
  Index: StylesheetPIHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/StylesheetPIHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StylesheetPIHandler.java  2000/10/30 18:40:42     1.3
  +++ StylesheetPIHandler.java  2000/11/03 23:28:03     1.4
  @@ -64,6 +64,9 @@
   import java.util.Vector;
   import java.util.StringTokenizer;
   
  +import javax.xml.transform.Source;
  +import javax.xml.transform.sax.SAXSource;
  +
   import org.apache.xalan.utils.SystemIDResolver;
   
   /**
  @@ -76,8 +79,8 @@
     /** NEEDSDOC Field STARTELEM_FOUND_MSG          */
     static final String STARTELEM_FOUND_MSG = "##startElement found";
   
  -  /** NEEDSDOC Field m_source          */
  -  InputSource m_source;
  +  /** NEEDSDOC Field m_baseID          */
  +  String m_baseID;
   
     /** NEEDSDOC Field m_media          */
     String m_media;
  @@ -99,11 +102,11 @@
      * NEEDSDOC @param title
      * NEEDSDOC @param charset
      */
  -  public StylesheetPIHandler(InputSource source, String media, String title,
  +  public StylesheetPIHandler(String baseID, String media, String title,
                                String charset)
     {
   
  -    m_source = source;
  +    m_baseID = baseID;
       m_media = media;
       m_title = title;
       m_charset = charset;
  @@ -114,21 +117,16 @@
      *
      * NEEDSDOC ($objectName$) @return
      */
  -  public InputSource[] getAssociatedStylesheets()
  +  public Source getAssociatedStylesheet()
     {
   
       int sz = m_stylesheets.size();
   
       if (sz > 0)
       {
  -      InputSource[] inputs = new InputSource[sz];
  -
  -      for (int i = 0; i < sz; i++)
  -      {
  -        inputs[i] = (InputSource) m_stylesheets.elementAt(i);
  -      }
  -
  -      return inputs;
  +      SAXSource ssource 
  +        = new SAXSource((InputSource) m_stylesheets.elementAt(sz-1));
  +      return ssource;
       }
       else
         return null;
  @@ -175,8 +173,7 @@
           {
             href = tokenizer.nextToken();
             href = href.substring(1, href.length() - 1);
  -          href = SystemIDResolver.getAbsoluteURI(href,
  -                                                 m_source.getSystemId());
  +          href = SystemIDResolver.getAbsoluteURI(href, m_baseID);
           }
           else if (name.equals("title"))
           {
  
  
  
  1.7       +3 -3      
xml-xalan/java/src/org/apache/xalan/processor/XSLTElementDef.java
  
  Index: XSLTElementDef.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTElementDef.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XSLTElementDef.java       2000/10/30 18:40:43     1.6
  +++ XSLTElementDef.java       2000/11/03 23:28:03     1.7
  @@ -426,12 +426,12 @@
     }
   
     /**
  -   * If non-null, the ContentHandler/Processor for this element.
  +   * If non-null, the ContentHandler/TransformerFactory for this element.
      */
     private XSLTElementProcessor m_elementProcessor;
   
     /**
  -   * Return the ContentHandler/Processor for this element.
  +   * Return the ContentHandler/TransformerFactory for this element.
      *
      * NEEDSDOC ($objectName$) @return
      */
  @@ -441,7 +441,7 @@
     }
   
     /**
  -   * Return the ContentHandler/Processor for this element.
  +   * Return the ContentHandler/TransformerFactory for this element.
      *
      * NEEDSDOC @param handler
      */
  
  
  
  1.7       +2 -2      
xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java
  
  Index: XSLTErrorResources.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XSLTErrorResources.java   2000/10/30 18:56:38     1.6
  +++ XSLTErrorResources.java   2000/11/03 23:28:06     1.7
  @@ -351,7 +351,7 @@
     static
     {
       contents[ER_COULD_NOT_CREATE_XML_PROC_LIAISON][1] =
  -      "Could not create XML Processor Liaison: {0}";
  +      "Could not create XML TransformerFactory Liaison: {0}";
     }
   
     /** NEEDSDOC Field ER_PROCESS_NOT_SUCCESSFUL          */
  @@ -664,7 +664,7 @@
   
     static
     {
  -    contents[ER_PROCESSOR_ERROR][1] = "XSLT Processor Error";
  +    contents[ER_PROCESSOR_ERROR][1] = "XSLT TransformerFactory Error";
     }
   
     /** NEEDSDOC Field ER_NOT_ALLOWED_INSIDE_STYLESHEET          */
  
  
  
  1.12      +1 -1      xml-xalan/java/src/org/apache/xalan/stree/Parent.java
  
  Index: Parent.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/stree/Parent.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Parent.java       2000/10/30 18:43:52     1.11
  +++ Parent.java       2000/11/03 23:28:07     1.12
  @@ -353,7 +353,7 @@
   
         if ((null != sh) && sh.m_shouldCheckWhitespace)
         {
  -        TransformerImpl transformer = sh.getTransformer();
  +        TransformerImpl transformer = sh.getTransformerImpl();
   
           if (null != transformer)
           {
  
  
  
  1.15      +76 -30    
xml-xalan/java/src/org/apache/xalan/stree/SourceTreeHandler.java
  
  Index: SourceTreeHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/SourceTreeHandler.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SourceTreeHandler.java    2000/10/30 18:43:53     1.14
  +++ SourceTreeHandler.java    2000/11/03 23:28:07     1.15
  @@ -66,6 +66,7 @@
   import org.apache.xalan.utils.XMLCharacterRecognizer;
   import org.apache.xalan.utils.BoolStack;
   import org.apache.xpath.XPathContext;
  +import org.apache.xpath.SourceTreeManager;
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xalan.templates.StylesheetRoot;
   import org.apache.xalan.templates.WhiteSpaceInfo;
  @@ -80,14 +81,22 @@
   import org.xml.sax.ContentHandler;
   import org.xml.sax.InputSource;
   
  -import org.apache.trax.Transformer;
  +import javax.xml.transform.Transformer;
  +import javax.xml.transform.TransformerException;
  +import javax.xml.transform.Source;
  +import javax.xml.transform.stream.StreamSource;
  +import javax.xml.transform.sax.TransformerHandler;
  +import javax.xml.transform.Result;
   
  +
   /**
    * This class handles SAX2 parse events to create a source
    * tree for transformation.
    */
  -public class SourceTreeHandler implements ContentHandler, LexicalHandler
  +public class SourceTreeHandler implements TransformerHandler
   {
  +  static int m_idCount = 0;
  +  int m_id;
   
     /**
      * Create a SourceTreeHandler that will start a transformation as
  @@ -97,7 +106,7 @@
      */
     public SourceTreeHandler(TransformerImpl transformer)
     {
  -
  +    m_id = m_idCount++;
       m_transformer = transformer;
   
       XPathContext xctxt = ((TransformerImpl) transformer).getXPathContext();
  @@ -109,16 +118,6 @@
       // else
       m_root = new DocumentImpl(this);
   
  -    String urlOfSource = transformer.getBaseURLOfSource();
  -
  -    if (null == m_inputSource)
  -    {
  -      m_inputSource = new InputSource(urlOfSource);
  -    }
  -
  -    transformer.getXPathContext().getSourceTreeManager().putDocumentInCache(
  -      m_root, m_inputSource);
  -
       m_initedRoot = false;
       m_shouldCheckWhitespace =
         transformer.getStylesheet().shouldCheckWhitespace();
  @@ -140,17 +139,6 @@
     /** NEEDSDOC Field m_transformer          */
     TransformerImpl m_transformer;
   
  -  /**
  -   * NEEDSDOC Method getTransformer 
  -   *
  -   *
  -   * NEEDSDOC (getTransformer) @return
  -   */
  -  public TransformerImpl getTransformer()
  -  {
  -    return m_transformer;
  -  }
  -
     /** NEEDSDOC Field m_sourceTreeHandler          */
     private DOMBuilder m_sourceTreeHandler;
   
  @@ -195,7 +183,7 @@
     }
   
     /** NEEDSDOC Field m_inputSource          */
  -  InputSource m_inputSource;
  +  Source m_inputSource;
   
     /**
      * NEEDSDOC Method setInputSource 
  @@ -203,7 +191,7 @@
      *
      * NEEDSDOC @param source
      */
  -  public void setInputSource(InputSource source)
  +  public void setInputSource(Source source)
     {
       m_inputSource = source;
     }
  @@ -214,7 +202,7 @@
      *
      * NEEDSDOC (getInputSource) @return
      */
  -  public InputSource getInputSource()
  +  public Source getInputSource()
     {
       return m_inputSource;
     }
  @@ -289,7 +277,7 @@
      */
     public void startDocument() throws SAXException
     {
  -
  +    // System.out.println("startDocument: "+m_id);
       synchronized (m_root)
       {
   
  @@ -338,6 +326,7 @@
   
       notifyWaiters();
     }
  +  
   
     /**
      * Implement the endDocument event.
  @@ -346,7 +335,7 @@
      */
     public void endDocument() throws SAXException
     {
  -
  +    // System.out.println("endDocument: "+m_id);
       ((Parent) m_root).setComplete(true);
   
       m_eventsCount = m_maxEventsToNotify;
  @@ -362,7 +351,14 @@
   
         if (!m_useMultiThreading && (null != m_transformer))
         {
  -        m_transformer.transformNode(m_root);
  +        try
  +        {
  +          m_transformer.transformNode(m_root);
  +        }
  +        catch(TransformerException te)
  +        {
  +          throw new SAXException(te);
  +        }
         }
       }
   
  @@ -816,4 +812,54 @@
   
       m_shouldStripWhitespaceStack.setTop(shouldStrip);
     }
  +  
  +  /**
  +   * Method setResult allows the user of the TransformerHandler
  +   * to set the result of the transform.
  +   *
  +   * @param result A Result instance, should not be null.
  +   * 
  +   * @throws TransformerException if result is invalid for some reason.
  +   */
  +  public void setResult(Result result)
  +    throws TransformerException
  +  {
  +    ContentHandler handler = 
m_transformer.createResultContentHandler(result);
  +    m_transformer.setContentHandler(handler);    
  +  }
  +  
  +  /**
  +   * Set the base ID (URL or system ID) from where relative 
  +   * URLs will be resolved.
  +   * @param baseID Base URL for the source tree.
  +   */
  +  public void setBaseID(String baseID)
  +  {
  +    m_transformer.setBaseURLOfSource(baseID);
  +    
  +    XPathContext xctxt = m_transformer.getXPathContext();
  +    SourceTreeManager stm = xctxt.getSourceTreeManager();
  +    
  +    stm.putDocumentInCache(m_root, new StreamSource(baseID));
  +  }
  +  
  +  /**
  +   * Get the Transformer associated with this handler, which 
  +   * is needed in order to set parameters and output properties.
  +   */
  +  public Transformer getTransformer()
  +  {
  +    return m_transformer;
  +  }
  +  
  +  /**
  +   * Get the Transformer associated with this handler, which 
  +   * is needed in order to set parameters and output properties.
  +   */
  +  TransformerImpl getTransformerImpl()
  +  {
  +    return m_transformer;
  +  }
  +
  +
   }
  
  
  
  1.6       +3 -1      
xml-xalan/java/src/org/apache/xalan/templates/ElemCallTemplate.java
  
  Index: ElemCallTemplate.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemCallTemplate.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ElemCallTemplate.java     2000/10/30 18:49:40     1.5
  +++ ElemCallTemplate.java     2000/11/03 23:28:07     1.6
  @@ -68,6 +68,8 @@
   import org.apache.xpath.VariableStack;
   import org.apache.xalan.transformer.TransformerImpl;
   
  +import javax.xml.transform.SourceLocator;
  +
   /**
    * <meta name="usage" content="advanced"/>
    * Implement xsl:call-template.
  @@ -172,7 +174,7 @@
         else
           vars.pushContextMarker();
   
  -      Locator savedLocator = xctxt.getSAXLocator();
  +      SourceLocator savedLocator = xctxt.getSAXLocator();
   
         try
         {
  
  
  
  1.10      +1 -1      
xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionDecl.java
  
  Index: ElemExtensionDecl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionDecl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ElemExtensionDecl.java    2000/10/30 18:49:46     1.9
  +++ ElemExtensionDecl.java    2000/11/03 23:28:07     1.10
  @@ -239,7 +239,7 @@
      * This function will be called on top-level elements
      * only, just before the transform begins.
      *
  -   * @param transformer The XSLT Processor.
  +   * @param transformer The XSLT TransformerFactory.
      *
      * @throws SAXException
      */
  
  
  
  1.5       +3 -1      
xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java
  
  Index: ElemForEach.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ElemForEach.java  2000/10/31 17:23:28     1.4
  +++ ElemForEach.java  2000/11/03 23:28:08     1.5
  @@ -76,6 +76,8 @@
   import org.apache.xalan.transformer.StackGuard;
   import org.apache.xalan.stree.SaxEventDispatch;
   
  +import javax.xml.transform.SourceLocator;
  +
   /**
    * <meta name="usage" content="advanced"/>
    * Implement xsl:for-each.
  @@ -380,7 +382,7 @@
       // Push the ContextNodeList on a stack, so that select="position()"
       // and the like will work.
       // System.out.println("pushing context node list...");
  -    Locator savedLocator = xctxt.getSAXLocator();
  +    SourceLocator savedLocator = xctxt.getSAXLocator();
   
       xctxt.pushContextNodeList((ContextNodeList) sourceNodes);
       transformer.pushElemTemplateElement(null);
  
  
  
  1.4       +3 -1      
xml-xalan/java/src/org/apache/xalan/templates/ElemTemplate.java
  
  Index: ElemTemplate.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplate.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ElemTemplate.java 2000/10/30 18:49:56     1.3
  +++ ElemTemplate.java 2000/11/03 23:28:08     1.4
  @@ -65,6 +65,8 @@
   import org.apache.xalan.res.XSLTErrorResources;
   import org.apache.xalan.transformer.TransformerImpl;
   
  +import javax.xml.transform.SourceLocator;
  +
   /**
    * <meta name="usage" content="advanced"/>
    * Implement xsl:template.
  @@ -127,7 +129,7 @@
      *
      * NEEDSDOC @param locator
      */
  -  public void setLocaterInfo(Locator locator)
  +  public void setLocaterInfo(SourceLocator locator)
     {
   
       m_publicId = locator.getPublicId();
  
  
  
  1.20      +7 -6      
xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java
  
  Index: ElemTemplateElement.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ElemTemplateElement.java  2000/10/31 19:04:24     1.19
  +++ ElemTemplateElement.java  2000/11/03 23:28:08     1.20
  @@ -77,7 +77,8 @@
   import org.apache.xpath.VariableStack;
   
   // TRaX imports
  -import org.apache.trax.Templates;
  +import javax.xml.transform.Templates;
  +import javax.xml.transform.SourceLocator;
   
   // Serializer imports
   import org.apache.serialize.OutputFormat;
  @@ -108,13 +109,13 @@
    * @see Stylesheet
    */
   public class ElemTemplateElement extends UnImplNode
  -        implements PrefixResolver, Serializable, Locator
  +        implements PrefixResolver, Serializable, SourceLocator
   {
   
     /**
      * Construct a template element instance.
      *
  -   * @param transformer The XSLT Processor.
  +   * @param transformer The XSLT TransformerFactory.
      * @param stylesheetTree The owning stylesheet.
      * @param name The name of the element.
      * @param atts The element attributes.
  @@ -160,7 +161,7 @@
      * This function will be called on top-level elements
      * only, just before the transform begins.
      *
  -   * @param transformer The XSLT Processor.
  +   * @param transformer The XSLT TransformerFactory.
      *
      * @throws SAXException
      */
  @@ -175,7 +176,7 @@
      * @exception java.io.FileNotFoundException
      * @exception java.io.IOException
      * @exception SAXException
  -   * @param transformer The XSLT Processor.
  +   * @param transformer The XSLT TransformerFactory.
      * @param sourceNode The current context node.
      * @param mode The current mode.
      */
  @@ -567,7 +568,7 @@
      *
      * NEEDSDOC @param locator
      */
  -  public void setLocaterInfo(Locator locator)
  +  public void setLocaterInfo(SourceLocator locator)
     {
       m_lineNumber = locator.getLineNumber();
       m_columnNumber = locator.getColumnNumber();
  
  
  
  1.12      +51 -17    
xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java
  
  Index: FuncDocument.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FuncDocument.java 2000/10/30 18:50:02     1.11
  +++ FuncDocument.java 2000/11/03 23:28:08     1.12
  @@ -60,6 +60,7 @@
   
   import java.io.StringWriter;
   import java.io.PrintWriter;
  +import java.io.IOException;
   
   import org.w3c.dom.Document;
   import org.w3c.dom.Node;
  @@ -88,7 +89,10 @@
   import org.xml.sax.SAXException;
   import org.xml.sax.SAXParseException;
   
  -import org.apache.trax.TransformException;
  +import javax.xml.transform.TransformerException;
  +import javax.xml.transform.SourceLocator;
  +import org.apache.xalan.utils.SAXSourceLocator;
  +import javax.xml.transform.Source;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -249,7 +253,22 @@
   
       // System.out.println("base: "+base+", uri: "+uri);
       SourceTreeManager treeMgr = xctxt.getSourceTreeManager();
  -    Node newDoc = treeMgr.findNodeFromURL(base, uri, xctxt.getSAXLocator());
  +    
  +    Node newDoc;
  +    try
  +    {
  +      Source source = treeMgr.resolveURI(base, uri, xctxt.getSAXLocator());
  +      newDoc = treeMgr.getNode(source);
  +    }
  +    catch (IOException ioe)
  +    {
  +      throw new SAXParseException(ioe.getMessage(), 
  +        (SAXSourceLocator)xctxt.getSAXLocator(), ioe);
  +    }
  +    catch(TransformerException te)
  +    {
  +      throw new SAXException(te);
  +    }
   
       if (null != newDoc)
         return newDoc;
  @@ -383,16 +402,25 @@
   
       String formattedMsg = XSLMessages.createMessage(msg, args);
       ErrorHandler errHandler = xctxt.getPrimaryReader().getErrorHandler();
  -    TransformException te = new TransformException(formattedMsg,
  -                              xctxt.getSAXLocator());
  +    SAXParseException spe = new SAXParseException(formattedMsg,
  +                              (SAXSourceLocator)xctxt.getSAXLocator());
   
       if (null != errHandler)
  -      errHandler.error(te);
  +      errHandler.error(spe);
       else
       {
  -      System.out.println(te.getMessage() + "; file " + te.getSystemId()
  -                         + "; line " + te.getLineNumber() + "; column "
  -                         + te.getColumnNumber());
  +      if(null != spe.getSystemId())
  +      {
  +        System.out.println(spe.getMessage() + "; file " 
  +                           + spe.getSystemId()
  +                           + "; line " + spe.getLineNumber() + "; column "
  +                           + spe.getColumnNumber());
  +      }
  +      else
  +      {
  +        System.out.println(spe.getMessage());
  +      }
  +      throw spe;
       }
     }
   
  @@ -412,19 +440,25 @@
     {
   
       String formattedMsg = XSLMessages.createWarning(msg, args);
  -    ErrorHandler errHandler = (null != xctxt.getPrimaryReader())
  -                              ? xctxt.getPrimaryReader().getErrorHandler()
  -                              : null;
  -    TransformException te = new TransformException(formattedMsg,
  -                              xctxt.getSAXLocator());
  +    ErrorHandler errHandler = xctxt.getPrimaryReader().getErrorHandler();
  +    SAXParseException spe = new SAXParseException(formattedMsg,
  +                              (SAXSourceLocator)xctxt.getSAXLocator());
   
       if (null != errHandler)
  -      errHandler.warning(te);
  +      errHandler.error(spe);
       else
       {
  -      System.out.println(te.getMessage() + "; file " + te.getSystemId()
  -                         + "; line " + te.getLineNumber() + "; column "
  -                         + te.getColumnNumber());
  +      if(null != spe.getSystemId())
  +      {
  +        System.out.println(spe.getMessage() + "; file " 
  +                           + spe.getSystemId()
  +                           + "; line " + spe.getLineNumber() + "; column "
  +                           + spe.getColumnNumber());
  +      }
  +      else
  +      {
  +        System.out.println(spe.getMessage());
  +      }
       }
     }
   
  
  
  
  1.8       +5 -2      
xml-xalan/java/src/org/apache/xalan/templates/FuncFormatNumb.java
  
  Index: FuncFormatNumb.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/FuncFormatNumb.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FuncFormatNumb.java       2000/10/30 18:50:02     1.7
  +++ FuncFormatNumb.java       2000/11/03 23:28:08     1.8
  @@ -71,10 +71,12 @@
   import org.apache.xalan.res.XSLTErrorResources;
   
   import org.xml.sax.ErrorHandler;
  +import org.xml.sax.SAXParseException;
   
   import org.w3c.dom.Node;
   
  -import org.apache.trax.TransformException;
  +import javax.xml.transform.TransformerException;
  +import org.apache.xalan.utils.SAXSourceLocator;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -200,7 +202,8 @@
       String formattedMsg = XSLMessages.createWarning(msg, args);
       ErrorHandler errHandler = xctxt.getPrimaryReader().getErrorHandler();
   
  -    errHandler.warning(new TransformException(formattedMsg));
  +    errHandler.warning(new SAXParseException(formattedMsg,
  +                                             
(SAXSourceLocator)xctxt.getSAXLocator()));
     }
   
     /**
  
  
  
  1.11      +3 -1      
xml-xalan/java/src/org/apache/xalan/templates/Stylesheet.java
  
  Index: Stylesheet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/Stylesheet.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Stylesheet.java   2000/10/31 17:08:34     1.10
  +++ Stylesheet.java   2000/11/03 23:28:08     1.11
  @@ -81,6 +81,8 @@
   import org.xml.sax.SAXException;
   import org.xml.sax.Locator;
   
  +import javax.xml.transform.SourceLocator;
  +
   /**
    * Represents a stylesheet element.
    * <p>All properties in this class have a fixed form of bean-style property
  @@ -1226,7 +1228,7 @@
      *
      * NEEDSDOC @param locator
      */
  -  public void setLocaterInfo(Locator locator)
  +  public void setLocaterInfo(SourceLocator locator)
     {
   
       if (null != locator)
  
  
  
  1.14      +1 -1      
xml-xalan/java/src/org/apache/xalan/templates/StylesheetComposed.java
  
  Index: StylesheetComposed.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/StylesheetComposed.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StylesheetComposed.java   2000/10/30 18:50:05     1.13
  +++ StylesheetComposed.java   2000/11/03 23:28:08     1.14
  @@ -60,7 +60,7 @@
   import java.util.Hashtable;
   import java.util.Enumeration;
   
  -import org.apache.trax.ProcessorException;
  +import javax.xml.transform.TransformerConfigurationException;
   import org.apache.xpath.XPath;
   import org.apache.xalan.utils.QName;
   import org.apache.serialize.OutputFormat;
  
  
  
  1.16      +65 -8     
xml-xalan/java/src/org/apache/xalan/templates/StylesheetRoot.java
  
  Index: StylesheetRoot.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/StylesheetRoot.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- StylesheetRoot.java       2000/11/03 08:42:34     1.15
  +++ StylesheetRoot.java       2000/11/03 23:28:08     1.16
  @@ -75,10 +75,12 @@
   import org.apache.xalan.res.XSLTErrorResources;
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xalan.transformer.TransformerImpl;
  -import org.apache.trax.Transformer;
  -import org.apache.trax.ProcessorException;
  -import org.apache.trax.Templates;
   
  +import javax.xml.transform.Transformer;
  +import javax.xml.transform.TransformerConfigurationException;
  +import javax.xml.transform.Templates;
  +import javax.xml.transform.stream.OutputKeys;
  +
   /**
    * <meta name="usage" content="general"/>
    * This class represents the root object of the stylesheet tree.
  @@ -91,9 +93,9 @@
      * Uses an XSL stylesheet document.
      * @param transformer  The XSLTProcessor implementation.
      * @param baseIdentifier The file name or URL for the XSL stylesheet.
  -   * @exception ProcessorException if the baseIdentifier can not be resolved 
to a URL.
  +   * @exception TransformerConfigurationException if the baseIdentifier can 
not be resolved to a URL.
      */
  -  public StylesheetRoot() throws ProcessorException
  +  public StylesheetRoot() throws TransformerConfigurationException
     {
   
       super(null);
  @@ -108,7 +110,7 @@
       }
       catch (SAXException se)
       {
  -      throw new ProcessorException("Can't init default templates!", se);
  +      throw new TransformerConfigurationException("Can't init default 
templates!", se);
       }
     }
   
  @@ -127,12 +129,67 @@
     /**
      * Create a new transformation context for this Templates object.
      *
  -   * NEEDSDOC ($objectName$) @return
  +   * @return A Transformer instance, never null.
      */
     public Transformer newTransformer()
     {
       return new TransformerImpl(this);
     }
  +  
  +  /**
  +   * Get the static properties for xsl:output.  The object returned will
  +   * be a clone of the internal values, and thus it can be mutated
  +   * without mutating the Templates object, and then handed in to
  +   * the process method.
  +   *
  +   * <p>For XSLT, Attribute Value Templates attribute values will
  +   * be returned unexpanded (since there is no context at this point).</p>
  +   *
  +   * @return A Properties object, not null.
  +   */
  +  public Properties getOutputProperties()
  +  {
  +    Properties oprops = new Properties();
  +    
  +    if (m_outputFormatComposed instanceof OutputFormatExtended)
  +    {
  +      OutputFormatExtended ofe = (OutputFormatExtended) 
m_outputFormatComposed;
  +      if(ofe.methodHasBeenSet())
  +        oprops.put(OutputKeys.METHOD, ofe.getMethod());
  +      if(ofe.indentHasBeenSet())
  +        oprops.put(OutputKeys.INDENT, ofe.getIndent() ? "yes" : "no");
  +      if(ofe.doctypePublicHasBeenSet())
  +        oprops.put(OutputKeys.DOCTYPE_PUBLIC, ofe.getDoctypePublicId());
  +      if(ofe.doctypeSystemHasBeenSet())
  +        oprops.put(OutputKeys.DOCTYPE_SYSTEM, ofe.getDoctypeSystemId());
  +      if(ofe.mediaTypeHasBeenSet())
  +        oprops.put(OutputKeys.MEDIA_TYPE, ofe.getMediaType());
  +      if(ofe.omitXmlDeclarationHasBeenSet())
  +        oprops.put(OutputKeys.OMIT_XML_DECLARATION, 
ofe.getOmitXMLDeclaration() ? "yes" : "no");
  +      if(ofe.standaloneHasBeenSet())
  +        oprops.put(OutputKeys.STANDALONE, ofe.getStandalone() ? "yes" : 
"no");
  +      if(ofe.encodingHasBeenSet())
  +        oprops.put(OutputKeys.ENCODING, ofe.getEncoding());
  +      if(ofe.versionHasBeenSet())
  +        oprops.put(OutputKeys.VERSION, ofe.getVersion());
  +    }
  +    else
  +    {
  +      OutputFormat ofe = m_outputFormatComposed;
  +      // Just set them all for now.
  +      oprops.put(OutputKeys.METHOD, ofe.getMethod());
  +      oprops.put(OutputKeys.INDENT, ofe.getIndent() ? "yes" : "no");
  +      oprops.put(OutputKeys.DOCTYPE_PUBLIC, ofe.getDoctypePublicId());
  +      oprops.put(OutputKeys.DOCTYPE_SYSTEM, ofe.getDoctypeSystemId());
  +      oprops.put(OutputKeys.MEDIA_TYPE, ofe.getMediaType());
  +      oprops.put(OutputKeys.OMIT_XML_DECLARATION, 
ofe.getOmitXMLDeclaration() ? "yes" : "no");
  +      oprops.put(OutputKeys.STANDALONE, ofe.getStandalone() ? "yes" : "no");
  +      oprops.put(OutputKeys.ENCODING, ofe.getEncoding());
  +      oprops.put(OutputKeys.VERSION, ofe.getVersion());
  +    }
  +    
  +    return oprops;
  +  }
   
     /**
      * Get the properties for xsl:output.  The object returned will
  @@ -153,7 +210,7 @@
      * the xsl:output elements have been merged; different output
      * methods may have different default values for an attribute.</p>
      * @see <a href="http://www.w3.org/TR/xslt#output";>output in XSLT 
Specification</a>
  -   * @return A OutputProperties object that may be mutated.
  +   * @return A Properties object that may be mutated.
      *
      * @see org.xml.org.apache.serialize.OutputFormat
      */
  
  
  
  1.3       +4 -4      
xml-xalan/java/src/org/apache/xalan/trace/GenerateEvent.java
  
  Index: GenerateEvent.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/trace/GenerateEvent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GenerateEvent.java        2000/10/30 18:56:51     1.2
  +++ GenerateEvent.java        2000/11/03 23:28:11     1.3
  @@ -80,7 +80,7 @@
   {
   
     /**
  -   * The XSLT Processor, which either directly or indirectly contains most 
needed information.
  +   * The XSLT TransformerFactory, which either directly or indirectly 
contains most needed information.
      * Accessing the m_stylesheetRoot member variable will get you to the 
stylesheet information.
      *
      * @see org.apache.xalan.xslt.TransformerImpl, 
org.apache.xalan.xslt.StylesheetRoot,
  @@ -177,7 +177,7 @@
     /**
      * Constructor for startDocument, endDocument events.
      *
  -   * @param processor The XSLT Processor instance.
  +   * @param processor The XSLT TransformerFactory instance.
      * @param eventType One of the EVENTTYPE_XXX constants.
      */
     public GenerateEvent(TransformerImpl processor, int eventType)
  @@ -189,7 +189,7 @@
     /**
      * Constructor for startElement, endElement events.
      *
  -   * @param processor The XSLT Processor Instance.
  +   * @param processor The XSLT TransformerFactory Instance.
      * @param eventType One of the EVENTTYPE_XXX constants.
      * @param name The name of the element.
      * @param atts The SAX attribute list.
  @@ -207,7 +207,7 @@
     /**
      * Constructor for characters, cdate events.
      *
  -   * @param processor The XSLT Processor instance.
  +   * @param processor The XSLT TransformerFactory instance.
      * @param eventType One of the EVENTTYPE_XXX constants.
      * @param ch The char array from the SAX event.
      * @param start The start offset to be used in the char array.
  
  
  
  1.4       +1 -1      
xml-xalan/java/src/org/apache/xalan/trace/SelectionEvent.java
  
  Index: SelectionEvent.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/trace/SelectionEvent.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SelectionEvent.java       2000/10/30 18:56:52     1.3
  +++ SelectionEvent.java       2000/11/03 23:28:11     1.4
  @@ -102,7 +102,7 @@
   
     /**
      * Create an event originating at the given node of the style tree.
  -   * @param processor The XSLT Processor.
  +   * @param processor The XSLT TransformerFactory.
      * @param sourceNode The current context node.
      * @param mode The current mode.
      * @param m_styleNode node in the style tree reference for the event.
  
  
  
  1.3       +1 -1      
xml-xalan/java/src/org/apache/xalan/trace/TracerEvent.java
  
  Index: TracerEvent.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/trace/TracerEvent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TracerEvent.java  2000/10/30 18:56:53     1.2
  +++ TracerEvent.java  2000/11/03 23:28:11     1.3
  @@ -92,7 +92,7 @@
   
     /**
      * Create an event originating at the given node of the style tree.
  -   * @param processor The XSLT Processor.
  +   * @param processor The XSLT TransformerFactory.
      * @param sourceNode The current context node.
      * @param mode The current mode.
      * @param m_styleNode node in the style tree reference for the event.
  
  
  
  1.4       +13 -11    
xml-xalan/java/src/org/apache/xalan/transformer/MsgMgr.java
  
  Index: MsgMgr.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/MsgMgr.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MsgMgr.java       2000/10/30 18:56:59     1.3
  +++ MsgMgr.java       2000/11/03 23:28:12     1.4
  @@ -60,11 +60,13 @@
   
   import org.xml.sax.SAXException;
   import org.xml.sax.Locator;
  +import org.xml.sax.helpers.LocatorImpl;
   import org.xml.sax.ErrorHandler;
  +import org.xml.sax.SAXParseException;
   
   import org.w3c.dom.Node;
   
  -import org.apache.trax.TransformException;
  +import javax.xml.transform.TransformerException;
   
   /**
    * This class will manage error messages, warning messages, and other types 
of
  @@ -108,14 +110,14 @@
       if (null != errHandler)
       {
         if (terminate)
  -        errHandler.fatalError(new TransformException(msg));
  +        errHandler.fatalError(new SAXParseException(msg, new LocatorImpl()));
         else
  -        errHandler.warning(new TransformException(msg));
  +        errHandler.warning(new SAXParseException(msg, new LocatorImpl()));
       }
       else
       {
         if (terminate)
  -        throw new TransformException(msg);
  +        throw new SAXException(msg);
         else
           System.out.println(msg);
       }
  @@ -191,7 +193,7 @@
       ErrorHandler errHandler = m_transformer.getErrorHandler();
   
       if (null != errHandler)
  -      errHandler.warning(new TransformException(formattedMsg));
  +      errHandler.warning(new SAXParseException(formattedMsg, new 
LocatorImpl()));
       else
         System.out.println(formattedMsg);
     }
  @@ -217,9 +219,9 @@
       ErrorHandler errHandler = m_transformer.getErrorHandler();
   
       if (null != errHandler)
  -      errHandler.fatalError(new TransformException(msg));
  +      errHandler.fatalError(new SAXParseException(msg, new LocatorImpl()));
       else
  -      throw new TransformException(msg);
  +      throw new SAXException(msg);
     }
   
     /**
  @@ -298,9 +300,9 @@
       ErrorHandler errHandler = m_transformer.getErrorHandler();
   
       if (null != errHandler)
  -      errHandler.fatalError(new TransformException(formattedMsg));
  +      errHandler.fatalError(new SAXParseException(formattedMsg, new 
LocatorImpl()));
       else
  -      throw new TransformException(formattedMsg);
  +      throw new SAXException(formattedMsg);
     }
   
     /**
  @@ -349,8 +351,8 @@
       ErrorHandler errHandler = m_transformer.getErrorHandler();
   
       if (null != errHandler)
  -      errHandler.warning(new TransformException(formattedMsg));
  +      errHandler.warning(new SAXParseException(formattedMsg, new 
LocatorImpl()));
       else
  -      throw new TransformException(formattedMsg);
  +      throw new SAXException(formattedMsg);
     }
   }
  
  
  
  1.6       +1 -1      
xml-xalan/java/src/org/apache/xalan/transformer/NodeSorter.java
  
  Index: NodeSorter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/NodeSorter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NodeSorter.java   2000/10/30 18:56:59     1.5
  +++ NodeSorter.java   2000/11/03 23:28:12     1.6
  @@ -92,7 +92,7 @@
     NumberFormat m_formatter = NumberFormat.getNumberInstance();
   
     /**
  -   * Construct a NodeSorter, passing in the XSL Processor
  +   * Construct a NodeSorter, passing in the XSL TransformerFactory
      * so it can know how to get the node data according to
      * the proper whitespace rules.
      *
  
  
  
  1.22      +0 -1      
xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java
  
  Index: ResultTreeHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ResultTreeHandler.java    2000/10/30 18:57:01     1.21
  +++ ResultTreeHandler.java    2000/11/03 23:28:12     1.22
  @@ -172,7 +172,6 @@
      */
     public void endDocument() throws SAXException
     {
  -
       flushPending(EVT_ENDDOCUMENT);
   
       QueuedStartDocument qsd = getQueuedDocAtBottom();
  
  
  
  1.4       +1 -1      
xml-xalan/java/src/org/apache/xalan/transformer/TransformState.java
  
  Index: TransformState.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformState.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TransformState.java       2000/10/30 18:57:02     1.3
  +++ TransformState.java       2000/11/03 23:28:12     1.4
  @@ -62,7 +62,7 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
   
  -import org.apache.trax.Transformer;
  +import javax.xml.transform.Transformer;
   
   /**
    * This interface is meant to be used by a consumer of
  
  
  
  1.40      +434 -164  
xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- TransformerImpl.java      2000/10/30 18:57:02     1.39
  +++ TransformerImpl.java      2000/11/03 23:28:12     1.40
  @@ -60,6 +60,8 @@
   import java.util.Stack;
   import java.util.Vector;
   import java.util.Enumeration;
  +import java.util.Properties;
  +import java.util.StringTokenizer;
   
   import java.io.StringWriter;
   import java.io.IOException;
  @@ -68,6 +70,7 @@
   // Xalan imports
   import org.apache.xalan.res.XSLTErrorResources;
   import org.apache.xalan.stree.SourceTreeHandler;
  +import org.apache.xalan.templates.OutputFormatExtended;
   import org.apache.xalan.templates.Constants;
   import org.apache.xalan.templates.ElemAttributeSet;
   import org.apache.xalan.templates.ElemTemplateElement;
  @@ -125,18 +128,29 @@
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   import org.xml.sax.XMLReader;
  +import org.xml.sax.XMLFilter;
   import org.xml.sax.Locator;
   import org.xml.sax.helpers.XMLReaderFactory;
   import org.xml.sax.ext.DeclHandler;
   import org.xml.sax.ext.LexicalHandler;
   import org.xml.sax.SAXNotRecognizedException;
   import org.xml.sax.SAXNotSupportedException;
  +import org.xml.sax.ErrorHandler;
   
   // TRaX Imports
  -import org.apache.trax.Result;
  -import org.apache.trax.Transformer;
  -import org.apache.trax.TransformException;
  -import org.apache.trax.URIResolver;
  +import javax.xml.transform.Source;
  +import javax.xml.transform.Result;
  +import javax.xml.transform.Transformer;
  +import javax.xml.transform.TransformerException;
  +import javax.xml.transform.TransformerException;
  +import javax.xml.transform.URIResolver;
  +import javax.xml.transform.SourceLocator;
  +import javax.xml.transform.dom.DOMSource;
  +import javax.xml.transform.dom.DOMResult;
  +import javax.xml.transform.sax.SAXSource;
  +import javax.xml.transform.sax.SAXResult;
  +import javax.xml.transform.stream.StreamResult;
  +import javax.xml.transform.stream.OutputKeys;
   
   // Imported JAVA API for XML Parsing 1.0 classes
   import javax.xml.parsers.DocumentBuilder;
  @@ -169,8 +183,8 @@
    * @see XSLTProcessorFactory
    * @see XSLTProcessor
    */
  -public class TransformerImpl extends XMLFilterImpl
  -        implements Transformer, Runnable, TransformState
  +public class TransformerImpl extends Transformer
  +        implements Runnable, TransformState
   {
     /**
      * True if the parser events should be on the main thread,
  @@ -188,7 +202,7 @@
      * The output format object set by the user.  May be null.
      */
     private OutputFormat m_outputFormat;
  -
  +  
     /** The output serializer         */
     private Serializer m_serializer;
     
  @@ -196,6 +210,11 @@
      * The content handler for the source input tree.
      */
     ContentHandler m_inputContentHandler;
  +  
  +  /**
  +   * The content handler for the result tree.
  +   */
  +  private ContentHandler m_outputContentHandler = null;
   
     /**
      * Use member variable to store param variables as they're
  @@ -303,6 +322,11 @@
      * of trace listeners. Set this to false for optimization purposes.
      */
     public static boolean S_DEBUG = false;
  +  
  +  /**
  +   * The SAX error handler, where errors and warnings are sent.
  +   */
  +  private ErrorHandler m_errorHandler = null;
   
     /**
      * The trace manager.
  @@ -318,7 +342,7 @@
      * parse thread is not the main thread, in order for the parse 
      * thread's run method to get to the input source.   
      * (Delete this if reversing threads is outlawed. -sb)    */
  -  private InputSource m_xmlSource;
  +  private Source m_xmlSource;
   
     /** This is needed for support of setSourceTreeDocForThread(Node doc),
      * which must be called in order for the transform thread's run 
  @@ -378,24 +402,6 @@
     // ========= Transformer Interface Implementation ==========
   
     /**
  -   * Transform a document.
  -   *
  -   * @param input The input source for the document entity.
  -   *
  -   * @param xmlSource A SAX InputSource object, must not be null.
  -   * @exception org.xml.sax.SAXException Any SAX exception, possibly
  -   *            wrapping another exception.
  -   * @exception java.io.IOException An IO exception from the parser,
  -   *            possibly from a byte stream or character stream
  -   *            supplied by the application.
  -   * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource)
  -   */
  -  public void parse(InputSource xmlSource) throws SAXException, IOException
  -  {
  -    transform(xmlSource);
  -  }
  -
  -  /**
      * <meta name="usage" content="experimental"/>
      * Get true if the parser events should be on the main thread,
      * false if not.  Experimental.  Can not be set right now.
  @@ -432,21 +438,35 @@
   
     /**
      * Process the source tree to SAX parse events.
  -   * @param xmlSource  The input for the source tree.
  +   * @param source  The input for the source tree.
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public void transform(InputSource xmlSource) throws TransformException
  +  public void transform(Source source) 
  +    throws TransformerException
     {
  -
  +    if(source instanceof DOMSource)
  +    {
  +      DOMSource dsource = (DOMSource)source;
  +      m_urlOfSource = dsource.getBaseID();
  +      this.transformNode(dsource.getNode());
  +      return;
  +    }
  +    InputSource xmlSource = SAXSource.sourceToInputSource(source);
  +    if(null == xmlSource)
  +    {
  +      throw new TransformerException("Can't transform a Source of type "+
  +        source.getClass().getName()+"!");
  +    }
  +    
       if (null != xmlSource.getSystemId())
         m_urlOfSource = xmlSource.getSystemId();
   
       try
       {
  -
  -      // Get an already set XMLReader, or create one.
  -      XMLReader reader = this.getParent();
  +      XMLReader reader = null;
  +      if(source instanceof SAXSource)
  +        reader = ((SAXSource)source).getXMLReader();
   
         if (null == reader)
         {
  @@ -484,7 +504,7 @@
         {
           SourceTreeHandler sth = (SourceTreeHandler) inputHandler;
   
  -        sth.setInputSource(xmlSource);
  +        sth.setInputSource(source);
           sth.setUseMultiThreading(true);
   
           Node doc = sth.getRoot();
  @@ -492,9 +512,9 @@
           if (null != doc)
           {
             getXPathContext().getSourceTreeManager().putDocumentInCache(doc,
  -                  xmlSource);
  +                  source);
   
  -          m_xmlSource = xmlSource;
  +          m_xmlSource = source;
             m_doc = doc;
   
             if (isParserEventsOnMain())
  @@ -528,14 +548,14 @@
   
         if (null != e)
         {
  -        if (e instanceof org.apache.trax.TransformException)
  -          throw (org.apache.trax.TransformException) e;
  +        if (e instanceof javax.xml.transform.TransformerException)
  +          throw (javax.xml.transform.TransformerException) e;
           else if (e instanceof org.apache.xalan.utils.WrappedRuntimeException)
  -          throw new org.apache.trax.TransformException(
  +          throw new javax.xml.transform.TransformerException(
               ((org.apache.xalan.utils.WrappedRuntimeException) 
e).getException());
           else
           {
  -          throw new org.apache.trax.TransformException(e);
  +          throw new javax.xml.transform.TransformerException(e);
           }
         }
         else if (null != m_resultTreeHandler)
  @@ -554,20 +574,17 @@
             ((org.apache.xalan.utils.WrappedRuntimeException) 
throwable).getException();
         }
   
  -      throw new TransformException(wre.getException());
  +      throw new TransformerException(wre.getException());
       }
       catch (SAXException se)
       {
  -      se.printStackTrace();
  +      // se.printStackTrace(); ?? -sb
   
  -      if (se instanceof TransformException)
  -        throw (TransformException) se;
  -      else
  -        throw new TransformException(se);
  +      throw new TransformerException(se);
       }
       catch (IOException ioe)
       {
  -      throw new TransformException(ioe);
  +      throw new TransformerException(ioe);
       }
       finally
       {
  @@ -584,6 +601,16 @@
     {
       return m_urlOfSource;
     }
  +  
  +  /**
  +   * Get the base URL of the source.
  +   *
  +   * @return The base URL of the source tree, or null. 
  +   */
  +  public void setBaseURLOfSource(String base)
  +  {
  +    m_urlOfSource = base;
  +  }
   
     /**
      * Get the value of a property.  Recognized properties are:
  @@ -601,17 +628,58 @@
      *            XMLReader recognizes the property name but
      *            cannot set the requested value.
      *
  -   * @throws SAXNotRecognizedException
  -   * @throws SAXNotSupportedException
  +   * @throws TransformerException
      */
  -  public Object getProperty(String name)
  -          throws SAXNotRecognizedException, SAXNotSupportedException
  -  {
  -
  -    if (name.equals("http://xml.apache.org/xslt/sourcebase";))
  -      return name;
  +  public String getOutputProperty(String name)
  +          throws TransformerException
  +  {    
  +    if (m_outputFormat instanceof OutputFormatExtended)
  +    {
  +      OutputFormatExtended ofe = (OutputFormatExtended) m_outputFormat;
  +      if(name.equals(OutputKeys.METHOD))
  +        return ofe.methodHasBeenSet() ? ofe.getMethod() : null;
  +      else if(name.equals(OutputKeys.INDENT))
  +        return ofe.indentHasBeenSet() ? (ofe.getIndent() ? "yes" : "no") : 
null;
  +      else if(name.equals(OutputKeys.DOCTYPE_PUBLIC))
  +        return ofe.doctypePublicHasBeenSet() ? ofe.getDoctypePublicId() : 
null;
  +      else if(name.equals(OutputKeys.DOCTYPE_SYSTEM))
  +        return ofe.doctypeSystemHasBeenSet() ? ofe.getDoctypeSystemId() : 
null;
  +      else if(name.equals(OutputKeys.MEDIA_TYPE))
  +        return ofe.mediaTypeHasBeenSet() ? ofe.getMediaType() : null;
  +      else if(name.equals(OutputKeys.OMIT_XML_DECLARATION))
  +        return ofe.omitXmlDeclarationHasBeenSet() ? 
(ofe.getOmitXMLDeclaration() ? "yes" : "no") : null;
  +      else if(name.equals(OutputKeys.STANDALONE))
  +        return ofe.standaloneHasBeenSet() ? (ofe.getStandalone() ? "yes" : 
"no") : null;
  +      else if(name.equals(OutputKeys.ENCODING))
  +        return ofe.encodingHasBeenSet() ? ofe.getEncoding() : null;
  +      else if(name.equals(OutputKeys.VERSION))
  +        return ofe.versionHasBeenSet() ? ofe.getVersion() : null;
  +    }
       else
  -      return super.getProperty(name);
  +    {
  +      OutputFormat ofe = m_outputFormat;
  +      // Just set them all for now.
  +      if(name.equals(OutputKeys.METHOD))
  +        return ofe.getMethod();
  +      else if(name.equals(OutputKeys.INDENT))
  +        return ofe.getIndent() ? "yes" : "no";
  +      else if(name.equals(OutputKeys.DOCTYPE_PUBLIC))
  +        return ofe.getDoctypePublicId();
  +      else if(name.equals(OutputKeys.DOCTYPE_SYSTEM))
  +        return ofe.getDoctypeSystemId();
  +      else if(name.equals(OutputKeys.MEDIA_TYPE))
  +        return ofe.getMediaType();
  +      else if(name.equals(OutputKeys.OMIT_XML_DECLARATION))
  +        return ofe.getOmitXMLDeclaration() ? "yes" : "no";
  +      else if(name.equals(OutputKeys.STANDALONE))
  +        return ofe.getStandalone() ? "yes" : "no";
  +      else if(name.equals(OutputKeys.ENCODING))
  +        return ofe.getEncoding();
  +      else if(name.equals(OutputKeys.VERSION))
  +        return ofe.getVersion();
  +    }
  +    
  +    return null;
     }
   
     /**
  @@ -629,19 +697,77 @@
      *            XMLReader recognizes the property name but
      *            cannot set the requested value.
      *
  -   * @throws SAXNotRecognizedException
  -   * @throws SAXNotSupportedException
  +   * @throws TransformerException
      */
  -  public void setProperty(String name, Object value)
  -          throws SAXNotRecognizedException, SAXNotSupportedException
  +  public void setOutputProperty(String name, String value)
  +    throws TransformerException
     {
  -
  -    if (name.equals("http://xml.apache.org/xslt/sourcebase";))
  -      m_urlOfSource = (String) value;
  -    else
  -      super.getProperty(name);
  +    OutputFormat ofe = m_outputFormat;
  +    if(null == ofe)
  +      ofe = m_stylesheetRoot.getOutputComposed();
  +    if(name.equals(OutputKeys.METHOD))
  +      ofe.setMethod(value);
  +    else if(name.equals(OutputKeys.INDENT))
  +      ofe.setIndent(value.equals("yes"));
  +    else if(name.equals(OutputKeys.DOCTYPE_PUBLIC))
  +      ofe.setDoctypePublicId(value);
  +    else if(name.equals(OutputKeys.DOCTYPE_SYSTEM))
  +      ofe.setDoctypeSystemId(value);
  +    else if(name.equals(OutputKeys.MEDIA_TYPE))
  +      ofe.setMediaType(value);
  +    else if(name.equals(OutputKeys.OMIT_XML_DECLARATION))
  +      ofe.setOmitXMLDeclaration(value.equals("yes"));
  +    else if(name.equals(OutputKeys.STANDALONE))
  +      ofe.setStandalone(value.equals("yes"));
  +    else if(name.equals(OutputKeys.ENCODING))
  +      ofe.setEncoding(value);
  +    else if(name.equals(OutputKeys.VERSION))
  +      ofe.setVersion(value);
  +  }
  +  
  +  /**
  +   * Set the output properties for the transformation.  These
  +   * properties will override properties set in the templates
  +   * with xsl:output.
  +   *
  +   * <p>If argument to this function is null, any properties
  +   * previously set will be removed.</p>
  +   *
  +   * @param oformat A set of output properties that will be
  +   * used to override any of the same properties in effect
  +   * for the transformation.
  +   */
  +  public void setOutputProperties(Properties oformat)
  +  {
  +    Enumeration names = oformat.propertyNames();
  +    OutputFormat ofe = m_outputFormat;
  +    if(null == ofe)
  +      ofe = m_stylesheetRoot.getOutputComposed();
  +    while(names.hasMoreElements())
  +    {
  +      String name = (String)names.nextElement();
  +      if(name.equals(OutputKeys.METHOD))
  +        ofe.setMethod(oformat.getProperty(name));
  +      else if(name.equals(OutputKeys.INDENT))
  +        ofe.setIndent(oformat.getProperty(name).equals("yes"));
  +      else if(name.equals(OutputKeys.DOCTYPE_PUBLIC))
  +        ofe.setDoctypePublicId(oformat.getProperty(name));
  +      else if(name.equals(OutputKeys.DOCTYPE_SYSTEM))
  +        ofe.setDoctypeSystemId(oformat.getProperty(name));
  +      else if(name.equals(OutputKeys.MEDIA_TYPE))
  +        ofe.setMediaType(oformat.getProperty(name));
  +      else if(name.equals(OutputKeys.OMIT_XML_DECLARATION))
  +        ofe.setOmitXMLDeclaration(oformat.getProperty(name).equals("yes"));
  +      else if(name.equals(OutputKeys.STANDALONE))
  +        ofe.setStandalone(oformat.getProperty(name).equals("yes"));
  +      else if(name.equals(OutputKeys.ENCODING))
  +        ofe.setEncoding(oformat.getProperty(name));
  +      else if(name.equals(OutputKeys.VERSION))
  +        ofe.setVersion(oformat.getProperty(name));
  +    }
     }
   
  +
     /**
      * <meta name="usage" content="internal"/>
      * Process the an input source to a DOM node.  FOR INTERNAL USE ONLY.
  @@ -650,10 +776,19 @@
      *
      * @return The Node result of the parse, never null.
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public Node parseToNode(InputSource xmlSource) throws TransformException
  +  public Node parseToNode(Source source) throws TransformerException
     {
  +    if(source instanceof DOMSource)
  +      return ((DOMSource)source).getNode();
  +    
  +    InputSource xmlSource = SAXSource.sourceToInputSource(source);
  +    if(null == xmlSource)
  +    {
  +      throw new TransformerException("Can't transform a Source of type "+
  +        source.getClass().getName()+"!");
  +    }
   
       // Duplicate code from above... but slightly different.  
       // TODO: Work on this...
  @@ -664,7 +799,9 @@
         try
         {
           // Get an already set XMLReader, or create one.
  -        XMLReader reader = this.getParent();
  +        XMLReader reader = null;
  +        if(source instanceof SAXSource)
  +          reader = ((SAXSource)source).getXMLReader();
   
           if (null == reader)
           {
  @@ -712,19 +849,19 @@
         }
         catch (java.lang.IllegalAccessException iae)
         {
  -        throw new TransformException(iae);
  +        throw new TransformerException(iae);
         }
         catch (InstantiationException ie)
         {
  -        throw new TransformException(ie);
  +        throw new TransformerException(ie);
         }
         catch (SAXException se)
         {
  -        throw new TransformException(se);
  +        throw new TransformerException(se);
         }
         catch (IOException ioe)
         {
  -        throw new TransformException(ioe);
  +        throw new TransformerException(ioe);
         }
   
       return doc;
  @@ -740,10 +877,10 @@
      * @return A valid ContentHandler that will create the 
      * result tree when it is fed SAX events.
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
     public ContentHandler createResultContentHandler(Result outputTarget)
  -          throws TransformException
  +          throws TransformerException
     {
       return createResultContentHandler(outputTarget, getOutputFormat());
     }
  @@ -759,33 +896,45 @@
      * @return A valid ContentHandler that will create the 
      * result tree when it is fed SAX events.
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
     public ContentHandler createResultContentHandler(
  -          Result outputTarget, OutputFormat format) throws TransformException
  +          Result outputTarget, OutputFormat format) throws 
TransformerException
     {
   
       ContentHandler handler;
   
       // If the Result object contains a Node, then create 
       // a ContentHandler that will add nodes to the input node.
  -    Node outputNode = outputTarget.getNode();
  -
  -    if (null != outputNode)
  +    Node outputNode = null;
  +    if(outputTarget instanceof DOMResult)
       {
  -      short type = outputNode.getNodeType();
  -      Document doc = (Node.DOCUMENT_NODE == type)
  -                     ? (Document) outputNode : outputNode.getOwnerDocument();
  +      outputNode = ((DOMResult)outputTarget).getNode();
   
  -      handler = (Node.DOCUMENT_FRAGMENT_NODE == type)
  -                ? new DOMBuilder(doc, (DocumentFragment) outputNode)
  -                : new DOMBuilder(doc, outputNode);
  -    }
  +      if (null != outputNode)
  +      {
  +        short type = outputNode.getNodeType();
  +        Document doc = (Node.DOCUMENT_NODE == type)
  +                       ? (Document) outputNode : 
outputNode.getOwnerDocument();
   
  +        handler = (Node.DOCUMENT_FRAGMENT_NODE == type)
  +                  ? new DOMBuilder(doc, (DocumentFragment) outputNode)
  +                    : new DOMBuilder(doc, outputNode);
  +      }
  +      else
  +      {
  +        throw new TransformerException("DOMResult Result doesn't contain a 
Node!");
  +      }
  +    }
  +    else if(outputTarget instanceof SAXResult)
  +    {
  +      handler = ((SAXResult)outputTarget).getHandler();
  +    }
       // Otherwise, create a ContentHandler that will serialize the 
       // result tree to either a stream or a writer.
  -    else
  +    else if(outputTarget instanceof StreamResult)
       {
  +      StreamResult sresult = (StreamResult)outputTarget;
         String method = format.getMethod();
   
         if (null == method)
  @@ -795,10 +944,10 @@
         {
           Serializer serializer = SerializerFactory.getSerializer(format);
   
  -        if (null != outputTarget.getCharacterStream())
  -          serializer.setWriter(outputTarget.getCharacterStream());
  +        if (null != sresult.getCharacterStream())
  +          serializer.setWriter(sresult.getCharacterStream());
           else
  -          serializer.setOutputStream(outputTarget.getByteStream());
  +          serializer.setOutputStream(sresult.getByteStream());
   
           handler = serializer.asContentHandler();
   
  @@ -806,13 +955,18 @@
         }
         catch (UnsupportedEncodingException uee)
         {
  -        throw new TransformException(uee);
  +        throw new TransformerException(uee);
         }
         catch (IOException ioe)
         {
  -        throw new TransformException(ioe);
  +        throw new TransformerException(ioe);
         }
       }
  +    else
  +    {
  +      throw new TransformerException("Can't transform to a Result of type "+
  +        outputTarget.getClass().getName()+"!");
  +    }
   
       return handler;
     }
  @@ -822,10 +976,10 @@
      * @param xmlSource  The input for the source tree.
      * @param outputTarget The output source target.
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public void transform(InputSource xmlSource, Result outputTarget)
  -          throws TransformException
  +  public void transform(Source xmlSource, Result outputTarget)
  +          throws TransformerException
     {
   
       ContentHandler handler = createResultContentHandler(outputTarget);
  @@ -841,10 +995,10 @@
      * @param node  The input source node, which can be any valid DOM node.
      * @param outputTarget The output source target.
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
     public void transformNode(Node node, Result outputTarget)
  -          throws TransformException
  +          throws TransformerException
     {
   
       ContentHandler handler = createResultContentHandler(outputTarget);
  @@ -860,9 +1014,9 @@
      * @param node  The input source node, which can be any valid DOM node.
      * @param outputTarget The output source target.
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public void transformNode(Node node) throws TransformException
  +  public void transformNode(Node node) throws TransformerException
     {
   
       try
  @@ -913,10 +1067,7 @@
       }
       catch (SAXException se)
       {
  -      if (se instanceof org.apache.trax.TransformException)
  -        throw (org.apache.trax.TransformException) se;
  -      else
  -        throw new TransformException(se);
  +      throw new TransformerException(se);
       }
     }
   
  @@ -1044,11 +1195,123 @@
   
       varstack.pushVariable(qname, xobject);
     }
  +  
  +  /**
  +   * Set a parameter for the transformation.
  +   *
  +   * @param name The name of the parameter,
  +   *             which may have a namespace URI.
  +   * @param value The value object.  This can be any valid Java object
  +   * -- it's up to the processor to provide the proper
  +   * coersion to the object, or simply pass it on for use
  +   * in extensions.
  +   */
  +  public void setParameter(String name, Object value)
  +  {
  +    StringTokenizer tokenizer = new StringTokenizer(name, "{}", false);
  +    try
  +    {
  +      // The first string might be the namespace, or it might be 
  +      // the local name, if the namespace is null.
  +      String s1 = tokenizer.nextToken();
  +      String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
  +      if(null == s2)
  +        setParameter(s1, null, value);
  +      else
  +        setParameter(s2, s1, value);
  +    }
  +    catch(java.util.NoSuchElementException  nsee)
  +    {
  +      // Should throw some sort of an error.
  +    }
  +  }
  +  
  +  /**
  +   * Get a parameter that was explicitly set with setParameter 
  +   * or setParameters.
  +   *
  +   * @return A parameter that has been set with setParameter 
  +   * or setParameters,
  +   * *not* all the xsl:params on the stylesheet (which require 
  +   * a transformation Source to be evaluated).
  +   */
  +  public Object getParameter(String name)
  +  {
  +    StringTokenizer tokenizer = new StringTokenizer(name, "{}", false);
  +    try
  +    {
  +      VariableStack varstack = getXPathContext().getVarStack();
  +      // The first string might be the namespace, or it might be 
  +      // the local name, if the namespace is null.
  +      QName qname;
  +      String s1 = tokenizer.nextToken();
  +      String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
  +      if(null == s2)
  +        qname = new QName(null, s1);
  +      else
  +        qname = new QName(s1, s2);
  +      try
  +      {
  +        return varstack.getVariable(qname);
  +      }
  +      catch(SAXException se)
  +      {
  +        return null;
  +      }
  +    }
  +    catch(java.util.NoSuchElementException  nsee)
  +    {
  +      // Should throw some sort of an error.
  +      return null;
  +    }  
  +  }
   
     /**
  +   * Set a bag of parameters for the transformation. Note that 
  +   * these will not be additive, they will replace the existing
  +   * set of parameters.
  +   *
  +   * @param name The name of the parameter,
  +   *             which may have a namespace URI.
  +   * @param value The value object.  This can be any valid Java object
  +   * -- it's up to the processor to provide the proper
  +   * coersion to the object, or simply pass it on for use
  +   * in extensions.
  +   */
  +  public void setParameters(Properties params)
  +  {
  +    resetParameters();
  +    Enumeration names = params.propertyNames();
  +    while(names.hasMoreElements())
  +    {
  +      String name = params.getProperty((String)names.nextElement());
  +      StringTokenizer tokenizer = new StringTokenizer(name, "{}", false);
  +      try
  +      {
  +        // The first string might be the namespace, or it might be 
  +        // the local name, if the namespace is null.
  +        String s1 = tokenizer.nextToken();
  +        String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
  +        if(null == s2)
  +          setParameter(s1, null, params.getProperty(name));
  +        else
  +          setParameter(s2, s1, params.getProperty(name));
  +      }
  +      catch(java.util.NoSuchElementException  nsee)
  +      {
  +        // Should throw some sort of an error.
  +      }
  +    }
  +  }
  +
  +  /**
      * Reset the parameters to a null list.
      */
  -  public void resetParameters(){}
  +  public void resetParameters()
  +  {
  +    VariableStack varstack = new VariableStack();
  +    getXPathContext().setVarStack(varstack);
  +  }
   
     /**
      * Given a template, search for
  @@ -1183,21 +1446,44 @@
       getXPathContext().getSourceTreeManager().setURIResolver(resolver);
     }
   
  +  // ======== End Transformer Implementation ========  
  +
     /**
  -   * Set the entity resolver, which will be passed on to any 
  -   * XMLReaders that are created.
  +   * Set the content event handler.
      *
  -   * @param resolver The entity resolver, or null.
  -   * 
  -   * @see org.xml.sax.EntityResolver
  +   * @param resolver The new content handler.
  +   * @exception java.lang.NullPointerException If the handler
  +   *            is null.
  +   * @see org.xml.sax.XMLReader#setContentHandler
      */
  -  public void setEntityResolver(org.xml.sax.EntityResolver resolver)
  +  public void setContentHandler (ContentHandler handler)
     {
  -    super.setEntityResolver(resolver);
  -    getXPathContext().getSourceTreeManager().setEntityResolver(resolver);
  +    if (handler == null) 
  +    {
  +      throw new NullPointerException("Null content handler");
  +    } 
  +    else 
  +    {
  +      m_outputContentHandler = handler;
  +      
  +      if (null == m_resultTreeHandler)
  +        m_resultTreeHandler = new ResultTreeHandler(this, handler);
  +      else
  +        m_resultTreeHandler.setContentHandler(handler);
  +    }
     }
   
  -  // ======== End Transformer Implementation ========  
  +
  +  /**
  +   * Get the content event handler.
  +   *
  +   * @return The current content handler, or null if none was set.
  +   * @see org.xml.sax.XMLReader#getContentHandler
  +   */
  +  public ContentHandler getContentHandler ()
  +  {
  +    return m_outputContentHandler;
  +  }
   
   
     /**
  @@ -1596,7 +1882,7 @@
   
       varstack.pushElemFrame();
   
  -    Locator savedLocator = xctxt.getSAXLocator();
  +    SourceLocator savedLocator = xctxt.getSAXLocator();
   
       try
       {
  @@ -2137,75 +2423,57 @@
   
       return m_msgMgr;
     }
  -
  +  
     /**
  -   * Get an instance of the trace manager for this transformation.
  -   * This object can be used to set trace listeners on various
  -   * events during the transformation.
  +   * Set the error event handler.
      *
  -   * @return A reference to the TraceManager, never null.
  +   * @param handle The new error handler.
  +   * @exception java.lang.NullPointerException If the handler
  +   *            is null.
  +   * @see org.xml.sax.XMLReader#setErrorHandler
      */
  -  public TraceManager getTraceManager()
  +  public void setErrorHandler (ErrorHandler handler)
     {
  -    return m_traceManager;
  +    if (handler == null) 
  +    {
  +      throw new NullPointerException("Null error handler");
  +    } 
  +    else 
  +    {
  +      m_errorHandler = handler;
  +    }
     }
   
  +
     /**
  -   * Set the parent reader.
  +   * Get the current error event handler.
      *
  -   * <p>This is the [EMAIL PROTECTED] org.xml.sax.XMLReader XMLReader} from 
which
  -   * this filter will obtain its events and to which it will pass its
  -   * configuration requests.  The parent may itself be another filter.</p>
  -   *
  -   * <p>If there is no parent reader set, any attempt to parse
  -   * or to set or get a feature or property will fail.</p>
  -   *
  -   * @param parent The parent XML reader.
  -   * @exception java.lang.NullPointerException If the parent is null.
  +   * @return The current error handler, or null if none was set.
  +   * @see org.xml.sax.XMLReader#getErrorHandler
      */
  -  public void setParent(XMLReader parent)
  +  public ErrorHandler getErrorHandler ()
     {
  -
  -    super.setParent(parent);
  -
  -    // the setting of the parent's content handler directly works 
  -    // because parse (InputSource input) is overridden, and 
  -    // setupParse(); in XMLFilterImpl is never called.
  -    parent.setContentHandler(getInputContentHandler());
  +    return m_errorHandler;
     }
   
  +
     /**
  -   * Allow an application to register a content event handler.
  -   *
  -   * <p>If the application does not register a content handler, all
  -   * content events reported by the SAX parser will be silently
  -   * ignored.</p>
  -   *
  -   * <p>Applications may register a new or different handler in the
  -   * middle of a parse, and the SAX parser must begin using the new
  -   * handler immediately.</p>
  +   * Get an instance of the trace manager for this transformation.
  +   * This object can be used to set trace listeners on various
  +   * events during the transformation.
      *
  -   * @param handler The content handler.
  -   * @exception java.lang.NullPointerException If the handler
  -   *            argument is null.
  -   * @see #getContentHandler
  +   * @return A reference to the TraceManager, never null.
      */
  -  public void setContentHandler(ContentHandler handler)
  +  public TraceManager getTraceManager()
     {
  -
  -    super.setContentHandler(handler);
  -
  -    if (null == m_resultTreeHandler)
  -      m_resultTreeHandler = new ResultTreeHandler(this, handler);
  -    else
  -      m_resultTreeHandler.setContentHandler(handler);
  +    return m_traceManager;
     }
   
     /**
      * Look up the value of a feature.
      *
      * <p>The feature name is any fully-qualified URI.  It is
  -   * possible for an Processor to recognize a feature name but
  +   * possible for an TransformerFactory to recognize a feature name but
      * to be unable to return its value; this is especially true
      * in the case of an adapter for a SAX1 Parser, which has
      * no way of knowing whether the underlying parser is
  @@ -2225,9 +2493,9 @@
      *        URI.
      * @return The current state of the feature (true or false).
      * @exception org.xml.sax.SAXNotRecognizedException When the
  -   *            Processor does not recognize the feature name.
  +   *            TransformerFactory does not recognize the feature name.
      * @exception org.xml.sax.SAXNotSupportedException When the
  -   *            Processor recognizes the feature name but
  +   *            TransformerFactory recognizes the feature name but
      *            cannot determine its value at this time.
      *
      * @throws SAXNotRecognizedException
  @@ -2358,7 +2626,8 @@
         }
         else
         {
  -        getXPathContext().getPrimaryReader().parse(m_xmlSource);
  +        InputSource isource = SAXSource.sourceToInputSource(m_xmlSource);
  +        getXPathContext().getPrimaryReader().parse(isource);
         }
       }
       catch (Exception e)
  @@ -2366,5 +2635,6 @@
         postExceptionFromThread(e);
       }
     }
  +  
   }  // end TransformerImpl class
   
  
  
  
  1.1                  
xml-xalan/java/src/org/apache/xalan/transformer/TrAXFilter.java
  
  Index: TrAXFilter.java
  ===================================================================
  package org.apache.xalan.transformer;
  
  import java.io.IOException;
  
  import org.xml.sax.SAXException;
  import org.xml.sax.InputSource;
  import org.xml.sax.XMLReader;
  import org.xml.sax.XMLFilter;
  import org.xml.sax.ContentHandler;
  import org.xml.sax.EntityResolver;
  import org.xml.sax.ErrorHandler;
  import org.xml.sax.DTDHandler;
  import org.xml.sax.ext.LexicalHandler;
  import org.xml.sax.helpers.XMLFilterImpl;
  import org.xml.sax.helpers.XMLReaderFactory;
  
  import javax.xml.transform.Templates;
  import javax.xml.transform.TransformerConfigurationException;
  
  import org.apache.xalan.stree.SourceTreeHandler;
  
  public class TrAXFilter extends XMLFilterImpl
  {
    private Templates m_templates;
    private TransformerImpl m_transformer;
      
    /**
     * Construct an empty XML filter, with no parent.
     *
     * <p>This filter will have no parent: you must assign a parent
     * before you start a parse or do any configuration with
     * setFeature or setProperty.</p>
     *
     * @see org.xml.sax.XMLReader#setFeature
     * @see org.xml.sax.XMLReader#setProperty
     */
    public TrAXFilter (Templates templates)
      throws TransformerConfigurationException
    {
      m_templates = templates;
      m_transformer = (TransformerImpl)templates.newTransformer();
    }
    
    /** Set the parent reader.
     *
     * <p>This is the [EMAIL PROTECTED] org.xml.sax.XMLReader XMLReader} from 
which 
     * this filter will obtain its events and to which it will pass its 
     * configuration requests.  The parent may itself be another filter.</p>
     *
     * <p>If there is no parent reader set, any attempt to parse
     * or to set or get a feature or property will fail.</p>
     *
     * @param parent The parent XML reader.
     * @exception java.lang.NullPointerException If the parent is null.
     */
    public void setParent (XMLReader parent)
    { 
      super.setParent(parent);
      
      if(null != parent.getContentHandler())
        this.setContentHandler(parent.getContentHandler());
  
      // Not really sure if we should do this here, but 
      // it seems safer in case someone calls parse() on 
      // the parent.
      setupParse ();
    }
    
    /**
     * Parse a document.
     *
     * @param input The input source for the document entity.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @exception java.io.IOException An IO exception from the parser,
     *            possibly from a byte stream or character stream
     *            supplied by the application.
     * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource)
     */
    public void parse (InputSource input)
      throws SAXException, IOException
    {
      if(null == getParent())
      {
        XMLReader parent = XMLReaderFactory.createXMLReader();
        try
        {
          parent.setFeature("http://xml.org/sax/features/namespace-prefixes";,
                            true);
          parent.setFeature("http://apache.org/xml/features/validation/dynamic";,
                            true);
        }
        catch (SAXException se){}
        setParent (parent);
      }
      else
        setupParse ();
  
      getParent().parse(input);
    }
    
    /**
     * Parse a document.
     *
     * @param systemId The system identifier as a fully-qualified URI.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @exception java.io.IOException An IO exception from the parser,
     *            possibly from a byte stream or character stream
     *            supplied by the application.
     * @see org.xml.sax.XMLReader#parse(java.lang.String)
     */
    public void parse (String systemId)
      throws SAXException, IOException
    {
      parse(new InputSource(systemId));
    }
  
  
    /**
     * Set up before a parse.
     *
     * <p>Before every parse, check whether the parent is
     * non-null, and re-register the filter for all of the 
     * events.</p>
     */
    private void setupParse ()
    {
      XMLReader p = getParent();
      if (p == null) {
        throw new NullPointerException("No parent for filter");
      }
      
      ContentHandler ch = m_transformer.getInputContentHandler();
      if(ch instanceof SourceTreeHandler)
        ((SourceTreeHandler)ch).setUseMultiThreading(true);
      p.setContentHandler(ch);
  
      if(ch instanceof EntityResolver)
        p.setEntityResolver((EntityResolver)ch);
      else
        p.setEntityResolver(this);
      
      if(ch instanceof DTDHandler)
        p.setDTDHandler((DTDHandler)ch);
      else
        p.setDTDHandler(this);
      
      if(null != m_transformer.getErrorHandler())
        p.setErrorHandler(m_transformer.getErrorHandler());
      else
        p.setErrorHandler(this);
    }
  
    /**
     * Set the content event handler.
     *
     * @param resolver The new content handler.
     * @exception java.lang.NullPointerException If the handler
     *            is null.
     * @see org.xml.sax.XMLReader#setContentHandler
     */
    public void setContentHandler (ContentHandler handler)
    {
      m_transformer.setContentHandler(handler);
      super.setContentHandler(m_transformer.getResultTreeHandler());
    }
    
    public void setErrorHandler (ErrorHandler handler)
    {
      m_transformer.setErrorHandler(handler);
    }
  
  }
  
  
  
  1.10      +5 -5      xml-xalan/java/src/org/apache/xalan/utils/TreeWalker.java
  
  Index: TreeWalker.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/utils/TreeWalker.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TreeWalker.java   2000/10/30 18:57:25     1.9
  +++ TreeWalker.java   2000/11/03 23:28:13     1.10
  @@ -88,19 +88,19 @@
      *
      * NEEDSDOC ($objectName$) @return
      */
  -  public ContentHandler getFormatterListener()
  +  public ContentHandler getcontentHandler()
     {
       return m_contentHandler;
     }
   
     /**
      * Constructor.
  -   * @param   formatterListener The implemention of the
  -   * FormatterListener operation (toXMLString, digest, ...)
  +   * @param   contentHandler The implemention of the
  +   * contentHandler operation (toXMLString, digest, ...)
      */
  -  public TreeWalker(ContentHandler formatterListener)
  +  public TreeWalker(ContentHandler contentHandler)
     {
  -    this.m_contentHandler = formatterListener;
  +    this.m_contentHandler = contentHandler;
     }
   
     /**
  
  
  
  1.1                  
xml-xalan/java/src/org/apache/xalan/utils/SAXSourceLocator.java
  
  Index: SAXSourceLocator.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, Lotus
   * Development Corporation., http://www.lotus.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.xalan.utils;
  
  import javax.xml.transform.SourceLocator;
  
  import org.xml.sax.helpers.LocatorImpl;
  import org.xml.sax.Locator;
  
  import java.io.Serializable;
  
  /**
   * Class SAXSourceLocator extends org.xml.sax.helpers.LocatorImpl
   * for the purpose of implementing the SourceLocator interface, 
   * and thus can be both a SourceLocator and a SAX Locator.
   */
  public class SAXSourceLocator extends LocatorImpl
          implements SourceLocator, Serializable
  {
  
    /**
     * Constructor SAXSourceLocator
     *
     */
    public SAXSourceLocator(){}
  
    /**
     * Constructor SAXSourceLocator
     *
     *
     * NEEDSDOC @param locator
     */
    public SAXSourceLocator(Locator locator)
    {
  
      this.setColumnNumber(locator.getColumnNumber());
      this.setLineNumber(locator.getLineNumber());
      this.setPublicId(locator.getPublicId());
      this.setSystemId(locator.getSystemId());
    }
  }
  
  
  
  1.14      +33 -70    xml-xalan/java/src/org/apache/xalan/xslt/Process.java
  
  Index: Process.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xslt/Process.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Process.java      2000/10/30 18:58:06     1.13
  +++ Process.java      2000/11/03 23:28:14     1.14
  @@ -85,17 +85,23 @@
   import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xalan.templates.StylesheetRoot;
   import org.apache.xalan.transformer.TransformerImpl;
  -import org.apache.xalan.processor.StylesheetProcessor;
  +import org.apache.xalan.processor.TransformerFactoryImpl;
   import org.apache.xalan.trace.PrintTraceListener;
   import org.apache.xalan.trace.TraceListener;
   import org.apache.xalan.trace.TraceManager;
   
   // Needed TRaX classes
  -import org.apache.trax.Result;
  -import org.apache.trax.Processor;
  -import org.apache.trax.ProcessorFactoryException;
  -import org.apache.trax.Transformer;
  -import org.apache.trax.Templates;
  +import javax.xml.transform.Result;
  +import javax.xml.transform.TransformerFactory;
  +import javax.xml.transform.TransformerConfigurationException;
  +import javax.xml.transform.TFactoryConfigurationError;
  +import javax.xml.transform.Transformer;
  +import javax.xml.transform.Templates;
  +import javax.xml.transform.Source;
  +import javax.xml.transform.stream.StreamResult;
  +import javax.xml.transform.stream.StreamSource;
  +import javax.xml.transform.sax.SAXTransformerFactory;
  +import javax.xml.transform.stream.OutputKeys;
   
   // Needed SAX classes
   import org.xml.sax.InputSource;
  @@ -193,20 +199,20 @@
       }
       else
       {
  -      Processor processor;
  +      TransformerFactory tfactory;
   
         try
         {
  -        processor = Processor.newInstance("xslt");
  +        tfactory = TransformerFactory.newInstance();
         }
  -      catch (ProcessorFactoryException pfe)
  +      catch (TFactoryConfigurationError pfe)
         {
           pfe.printStackTrace(dumpWriter);
           diagnosticsWriter.println(
             XSLMessages.createMessage(
               XSLTErrorResources.ER_NOT_SUCCESSFUL, null));  //"XSL Process 
was not successful.");
   
  -        processor = null;  // shut up compiler
  +        tfactory = null;  // shut up compiler
   
           System.exit(-1);
         }
  @@ -222,7 +228,6 @@
         String media = null;
         Vector params = new Vector();
         boolean quietConflictWarnings = false;
  -      boolean isSAX = false;
   
         for (int i = 0; i < argv.length; i++)
         {
  @@ -233,7 +238,7 @@
   
             tracer.m_traceTemplates = true;
   
  -          // processor.setTraceTemplates(true);
  +          // tfactory.setTraceTemplates(true);
           }
           else if ("-TG".equalsIgnoreCase(argv[i]))
           {
  @@ -242,7 +247,7 @@
   
             tracer.m_traceGeneration = true;
   
  -          // processor.setTraceSelect(true);
  +          // tfactory.setTraceSelect(true);
           }
           else if ("-TS".equalsIgnoreCase(argv[i]))
           {
  @@ -251,7 +256,7 @@
   
             tracer.m_traceSelection = true;
   
  -          // processor.setTraceTemplates(true);
  +          // tfactory.setTraceTemplates(true);
           }
           else if ("-TTC".equalsIgnoreCase(argv[i]))
           {
  @@ -260,7 +265,7 @@
   
             tracer.m_traceElements = true;
   
  -          // processor.setTraceTemplateChildren(true);
  +          // tfactory.setTraceTemplateChildren(true);
           }
           else if ("-INDENT".equalsIgnoreCase(argv[i]))
           {
  @@ -405,10 +410,6 @@
           {
             outputType = "html";
           }
  -        else if ("-SAX".equalsIgnoreCase(argv[i]))
  -        {
  -          isSAX = true;
  -        }
           else if ("-EDUMP".equalsIgnoreCase(argv[i]))
           {
             doStackDumpOnError = true;
  @@ -436,7 +437,7 @@
   
           Templates stylesheet =
             (null != xslFileName)
  -          ? processor.process(new InputSource(xslFileName)) : null;
  +          ? tfactory.newTemplates(new StreamSource(xslFileName)) : null;
           PrintWriter resultWriter;
           OutputStream outputStream = (null != outFileName)
                                       ? new FileOutputStream(outFileName)
  @@ -446,12 +447,13 @@
           // document?
           if (null == stylesheet)
           {
  -          InputSource[] sources =
  -            processor.getAssociatedStylesheets(new InputSource(inFileName),
  +          SAXTransformerFactory stf = (SAXTransformerFactory)tfactory;
  +          Source source =
  +            stf.getAssociatedStylesheet(new StreamSource(inFileName),
                                                  media, null, null);
   
  -          if ((null != sources) && (sources.length > 0))
  -            stylesheet = processor.processMultiple(sources);
  +          if (null != source)
  +            stylesheet = tfactory.newTemplates(source);
             else
             {
               if (null != media)
  @@ -470,10 +472,8 @@
             // Override the output format?
             if (null != outputType)
             {
  -            OutputFormat of = stylesheet.getOutputFormat();
  -
  -            of.setMethod(outputType);
  -            transformer.setOutputFormat(of);
  +            transformer.setOutputProperty(OutputKeys.METHOD,
  +                                          outputType);
             }
   
             if (transformer instanceof TransformerImpl)
  @@ -493,59 +493,22 @@
   
             for (int i = 0; i < nParams; i += 2)
             {
  -            transformer.setParameter((String) params.elementAt(i), null,
  +            transformer.setParameter((String) params.elementAt(i),
                                        (String) params.elementAt(i + 1));
             }
   
             if (null != inFileName)
             {
  -            if (isSAX)
  -            {
  -              OutputFormat format = stylesheet.getOutputFormat();
  -
  -              if (null != outputType)
  -                format.setMethod(outputType);
  -
  -              Serializer serializer = 
SerializerFactory.getSerializer(format);
  -
  -              serializer.setOutputStream(outputStream);
  -              transformer.setContentHandler(serializer.asContentHandler());
  -              
transformer.setProperty("http://xml.apache.org/xslt/sourcebase";,
  -                                      inFileName);
  -
  -              XMLReader reader = XMLReaderFactory.createXMLReader();
  -
  -              reader.setFeature(
  -                "http://xml.org/sax/features/namespace-prefixes";, true);
  -              reader.setFeature(
  -                "http://apache.org/xml/features/validation/dynamic";, true);
  -
  -              ContentHandler chandler = transformer.getInputContentHandler();
  -
  -              reader.setContentHandler(chandler);
  -
  -              if (chandler instanceof org.xml.sax.ext.LexicalHandler)
  -                reader.setProperty(
  -                  "http://xml.org/sax/properties/lexical-handler";, chandler);
  -              else
  -                reader.setProperty(
  -                  "http://xml.org/sax/properties/lexical-handler";, null);
  -
  -              reader.parse(inFileName);
  -            }
  -            else
  -            {
  -              transformer.transform(new InputSource(inFileName),
  -                                    new Result(outputStream));
  -            }
  +            transformer.transform(new StreamSource(inFileName),
  +                                  new StreamResult(outputStream));
             }
             else
             {
               StringReader reader =
                 new StringReader("<?xml version=\"1.0\"?> <doc/>");
   
  -            transformer.transform(new InputSource(reader),
  -                                  new Result(outputStream));
  +            transformer.transform(new StreamSource(reader),
  +                                  new StreamResult(outputStream));
             }
           }
           else
  
  
  
  1.5       +13 -7     xml-xalan/java/src/org/apache/xpath/Expression.java
  
  Index: Expression.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/Expression.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Expression.java   2000/10/30 18:58:22     1.4
  +++ Expression.java   2000/11/03 23:28:14     1.5
  @@ -63,8 +63,11 @@
   import org.apache.xalan.res.XSLMessages;
   
   import org.xml.sax.ErrorHandler;
  +import org.xml.sax.SAXParseException;
   
  -import org.apache.trax.ProcessorException;
  +import javax.xml.transform.TransformerConfigurationException;
  +import org.apache.xalan.utils.SAXSourceLocator;
  +import javax.xml.transform.SourceLocator;
   
   /**
    * <meta name="usage" content="internal"/>
  @@ -110,7 +113,7 @@
       {
   
         // TO DO: Need to get stylesheet Locator from here.
  -      eh.warning(new ProcessorException(fmsg));
  +      eh.warning(new SAXParseException(fmsg, 
(SAXSourceLocator)xctxt.getSAXLocator()));
       }
     }
   
  @@ -152,17 +155,20 @@
     {
   
       java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args);
  -    ProcessorException te = new ProcessorException(fmsg,
  -                              m_xpath.getLocator());
       ErrorHandler eh = xctxt.getPrimaryReader().getErrorHandler();
   
       if (null != eh)
  +    {
  +      SAXParseException te = new SAXParseException(fmsg,
  +                      (SAXSourceLocator)m_xpath.getLocator());
         eh.fatalError(te);
  +    }
       else
       {
  -      System.out.println(te.getMessage() + "; file " + te.getSystemId()
  -                         + "; line " + te.getLineNumber() + "; column "
  -                         + te.getColumnNumber());
  +      SourceLocator slocator = m_xpath.getLocator();
  +      System.out.println(fmsg + "; file " + slocator.getSystemId()
  +                         + "; line " + slocator.getLineNumber() + "; column "
  +                         + slocator.getColumnNumber());
       }
     }
   }
  
  
  
  1.10      +75 -149   
xml-xalan/java/src/org/apache/xpath/SourceTreeManager.java
  
  Index: SourceTreeManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/SourceTreeManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SourceTreeManager.java    2000/10/30 18:58:24     1.9
  +++ SourceTreeManager.java    2000/11/03 23:28:14     1.10
  @@ -67,8 +67,8 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.Document;
   
  -import org.apache.trax.URIResolver;
  -import org.apache.trax.TransformException;
  +import javax.xml.transform.URIResolver;
  +import javax.xml.transform.TransformerException;
   
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  @@ -77,13 +77,20 @@
   import org.xml.sax.XMLReader;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.EntityResolver;
  -import org.xml.sax.Locator;
  +// import org.xml.sax.Locator;
   
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xalan.stree.SourceTreeHandler;
   import org.apache.xalan.utils.SystemIDResolver;
   import org.apache.xpath.res.XPATHErrorResources;
   
  +import javax.xml.transform.SourceLocator;
  +import javax.xml.transform.Source;
  +import javax.xml.transform.sax.SAXSource;
  +import javax.xml.transform.dom.DOMSource;
  +import javax.xml.transform.stream.StreamSource;
  +import org.apache.xalan.utils.SAXSourceLocator;
  +
   /**
    * This class bottlenecks all management of source trees.  The methods
    * in this class should allow easy garbage collection of source
  @@ -173,56 +180,24 @@
      * NEEDSDOC ($objectName$) @return
      *
      * @throws IOException
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public InputSource resolveURI(
  -          String base, String urlString, Locator locator)
  -            throws TransformException, IOException
  +  public Source resolveURI(
  +          String base, String urlString, SourceLocator locator)
  +            throws TransformerException, IOException, SAXException
     {
  -
  -    String uri;
  -
  -    try
  +    Source source = null;
  +    
  +    if(null != m_uriResolver)
       {
  -      uri = SystemIDResolver.getAbsoluteURI(urlString, base);
  +      source = m_uriResolver.resolve(urlString, base);
       }
  -    catch (SAXException se)
  +    
  +    if(null == source)
       {
  +      String uri = SystemIDResolver.getAbsoluteURI(urlString, base);
   
  -      // Try and see if the entity resolver can do the job. 
  -      // If not, throw an exception.
  -      if (null != m_entityResolver)
  -      {
  -        try
  -        {
  -          return m_entityResolver.resolveEntity(null, urlString);
  -        }
  -        catch (SAXException se2)
  -        {
  -          throw new TransformException("URL of base: " + base + " and url: "
  -                                       + urlString + " can't be resolved",
  -                                         locator, se2);
  -        }
  -      }
  -      else
  -        throw new TransformException("URL of base: " + base + " and url: "
  -                                     + urlString + " can't be resolved",
  -                                       locator, se);
  -    }
  -
  -    InputSource source;
  -
  -    try
  -    {
  -      if (null != m_entityResolver)
  -        source = m_entityResolver.resolveEntity(null, urlString);
  -      else
  -        source = new InputSource(uri);
  -    }
  -    catch (SAXException se2)
  -    {
  -      throw new TransformException("URL: " + urlString
  -                                   + " can't be resolved", locator, se2);
  +      source = new StreamSource(uri);
       }
   
       return source;
  @@ -235,12 +210,12 @@
      * NEEDSDOC @param n
      * NEEDSDOC @param source
      */
  -  public void putDocumentInCache(Node n, InputSource source)
  +  public void putDocumentInCache(Node n, Source source)
     {
   
       try
       {
  -      Node cachedNode = findNodeFromURL(source);
  +      Node cachedNode = getNode(source);
   
         if (null != cachedNode)
         {
  @@ -248,17 +223,17 @@
             throw new RuntimeException(
               "Programmer's Error!  "
               + "putDocumentInCache found reparse of doc: "
  -            + source.getSystemId());
  +            + source.getBaseID());
   
           return;
         }
   
  -      if (null != source.getSystemId())
  +      if (null != source.getBaseID())
         {
  -        m_sourceTree.addElement(new SourceTree(n, source.getSystemId()));
  +        m_sourceTree.addElement(new SourceTree(n, source.getBaseID()));
         }
       }
  -    catch (TransformException te)
  +    catch (TransformerException te)
       {
         throw new org.apache.xalan.utils.WrappedRuntimeException(te);
       }
  @@ -272,12 +247,15 @@
      *
      * NEEDSDOC ($objectName$) @return
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public Node findNodeFromURL(InputSource source) throws TransformException
  +  public Node getNode(Source source) throws TransformerException
     {
  +    if(source instanceof DOMSource)
  +      return ((DOMSource)source).getNode();
   
  -    String url = source.getSystemId();
  +    // TODO: Not sure if the BaseID is really the same thing as the ID.
  +    String url = source.getBaseID();
   
       if (null == url)
         return null;
  @@ -286,13 +264,13 @@
       int n = m_sourceTree.size();
       ;
   
  -    // System.out.println("findNodeFromURL: "+n);
  +    // System.out.println("getNode: "+n);
       for (int i = 0; i < n; i++)
       {
         SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i);
   
  -      // System.out.println("findNodeFromURL -         url: "+url);
  -      // System.out.println("findNodeFromURL - sTree.m_url: "+sTree.m_url);
  +      // System.out.println("getNode -         url: "+url);
  +      // System.out.println("getNode - sTree.m_url: "+sTree.m_url);
         if (url.equals(sTree.m_url))
         {
           node = sTree.m_root;
  @@ -301,61 +279,11 @@
         }
       }
   
  -    // System.out.println("findNodeFromURL - returning: "+node);
  +    // System.out.println("getNode - returning: "+node);
       return node;
     }
   
     /**
  -   * Given a URL, find the node associated with that document.
  -   *
  -   * NEEDSDOC @param base
  -   * @param url
  -   * NEEDSDOC @param locator
  -   *
  -   * NEEDSDOC ($objectName$) @return
  -   *
  -   * @throws TransformException
  -   */
  -  public Node findNodeFromURL(String base, String url, Locator locator)
  -          throws TransformException
  -  {
  -
  -    try
  -    {
  -      InputSource source = this.resolveURI(base, url, locator);
  -
  -      if (null != source.getSystemId())
  -        url = source.getSystemId();
  -
  -      Node node = null;
  -      int n = m_sourceTree.size();
  -      ;
  -
  -      // System.out.println("findNodeFromURL: "+n);
  -      for (int i = 0; i < n; i++)
  -      {
  -        SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i);
  -
  -        // System.out.println("findNodeFromURL -         url: "+url);
  -        // System.out.println("findNodeFromURL - sTree.m_url: "+sTree.m_url);
  -        if (url.equals(sTree.m_url))
  -        {
  -          node = sTree.m_root;
  -
  -          break;
  -        }
  -      }
  -
  -      // System.out.println("findNodeFromURL - returning: "+node);
  -      return node;
  -    }
  -    catch (IOException ioe)
  -    {
  -      throw new TransformException(ioe, locator);
  -    }
  -  }
  -
  -  /**
      * Get the source tree from the a base URL and a URL string.
      *
      * NEEDSDOC @param base
  @@ -364,24 +292,28 @@
      *
      * NEEDSDOC ($objectName$) @return
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public Node getSourceTree(String base, String urlString, Locator locator)
  -          throws TransformException
  +  public Node getSourceTree(String base, String urlString, SourceLocator 
locator)
  +          throws SAXException
     {
   
       // System.out.println("getSourceTree");
       try
       {
  -      InputSource source = this.resolveURI(base, urlString, locator);
  +      Source source = this.resolveURI(base, urlString, locator);
   
         // System.out.println("getSourceTree - base: "+base+", urlString: 
"+urlString+", source: "+source.getSystemId());
         return getSourceTree(source, locator);
       }
       catch (IOException ioe)
       {
  -      throw new TransformException(ioe, locator);
  +      throw new SAXParseException(ioe.getMessage(), 
(SAXSourceLocator)locator, ioe);
       }
  +    catch (TransformerException te)
  +    {
  +      throw new SAXParseException(te.getMessage(), 
(SAXSourceLocator)locator, te);
  +    }
     }
   
     /**
  @@ -392,34 +324,22 @@
      *
      * NEEDSDOC ($objectName$) @return
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public Node getSourceTree(InputSource source, Locator locator)
  -          throws TransformException
  +  public Node getSourceTree(Source source, SourceLocator locator)
  +          throws TransformerException
     {
  +    Node n = getNode(source);
   
  -    // Try first to see if we have a node cached that matches this 
  -    // systemID.
  -    if (null != source.getSystemId())
  -    {
  -      Node n = findNodeFromURL(null, source.getSystemId(), locator);
  +    if (null != n)
  +      return n;
   
  -      if (null != n)
  -        return n;
  -    }
  +    n = getDOMNode(source, locator);
   
  -    Node root = null;
  +    if (null != n)
  +      putDocumentInCache(n, source);
   
  -    if (null != m_uriResolver)
  -      root = m_uriResolver.getDOMNode(source);
  -
  -    if (null == root)
  -      root = getDOMNode(source, locator);
  -
  -    if (null != root)
  -      putDocumentInCache(root, source);
  -
  -    return root;
  +    return n;
     }
   
     /**
  @@ -430,11 +350,16 @@
      *
      * NEEDSDOC ($objectName$) @return
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public Node getDOMNode(InputSource source, Locator locator)
  -          throws TransformException
  +  public Node getDOMNode(Source source, SourceLocator locator)
  +          throws TransformerException
     {
  +    
  +    if(source instanceof DOMSource)
  +    {
  +      return ((DOMSource)source).getNode();
  +    }
   
       Node doc = null;
   
  @@ -465,7 +390,8 @@
         }
         catch (SAXException se){}
   
  -      reader.parse(source);
  +      InputSource isource = SAXSource.sourceToInputSource(source);
  +      reader.parse(isource);
   
         if (handler instanceof org.apache.xalan.stree.SourceTreeHandler)
         {
  @@ -474,11 +400,11 @@
       }
       catch (IOException ioe)
       {
  -      throw new TransformException(ioe, locator);
  +      throw new TransformerException(ioe.getMessage(), locator, ioe);
       }
       catch (SAXException se)
       {
  -      throw new TransformException(se, locator);
  +      throw new TransformerException(se.getMessage(), locator, se);
       }
   
       return doc;
  @@ -498,16 +424,16 @@
      *
      * NEEDSDOC ($objectName$) @return
      *
  -   * @throws TransformException
  +   * @throws TransformerException
      */
  -  public XMLReader getXMLReader(InputSource inputSource, Locator locator)
  -          throws TransformException
  +  public XMLReader getXMLReader(Source inputSource, SourceLocator locator)
  +          throws TransformerException
     {
   
       try
       {
  -      XMLReader reader = (null != m_uriResolver)
  -                         ? m_uriResolver.getXMLReader(inputSource) : null;
  +      XMLReader reader = (inputSource instanceof SAXSource)
  +                         ? ((SAXSource)inputSource).getXMLReader() : null;
   
         if (null == reader)
           reader = XMLReaderFactory.createXMLReader();
  @@ -530,7 +456,7 @@
       }
       catch (SAXException se)
       {
  -      throw new TransformException(se, locator);
  +      throw new TransformerException(se.getMessage(), locator, se);
       }
     }
   }
  
  
  
  1.9       +27 -23    xml-xalan/java/src/org/apache/xpath/XPath.java
  
  Index: XPath.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPath.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XPath.java        2000/10/30 18:58:25     1.8
  +++ XPath.java        2000/11/03 23:28:14     1.9
  @@ -84,9 +84,12 @@
   import org.apache.xpath.objects.*;
   
   import org.xml.sax.ErrorHandler;
  -import org.xml.sax.Locator;
  +import org.xml.sax.SAXParseException;
  +// import org.xml.sax.Locator;
   
  -import org.apache.trax.TransformException;
  +import javax.xml.transform.TransformerException;
  +import javax.xml.transform.SourceLocator;
  +import org.apache.xalan.utils.SAXSourceLocator;
   import org.apache.xpath.patterns.NodeTest;
   
   /**
  @@ -129,7 +132,7 @@
     }
   
     /** NEEDSDOC Field m_locator          */
  -  private Locator m_locator;
  +  private SourceLocator m_locator;
   
     /**
      * NEEDSDOC Method getLocator 
  @@ -137,7 +140,7 @@
      *
      * NEEDSDOC (getLocator) @return
      */
  -  public Locator getLocator()
  +  public SourceLocator getLocator()
     {
       return m_locator;
     }
  @@ -148,7 +151,7 @@
      *
      * NEEDSDOC @param l
      */
  -  public void setLocator(Locator l)
  +  public void setLocator(SourceLocator l)
     {
        // Note potential hazards -- l may not be serializable, or may be 
changed
          // after being assigned here.
  @@ -187,15 +190,10 @@
      * @throws org.xml.sax.SAXException
      */
     public XPath(
  -          String exprString, Locator locator, PrefixResolver prefixResolver, 
int type)
  +          String exprString, SourceLocator locator, PrefixResolver 
prefixResolver, int type)
               throws org.xml.sax.SAXException
     {
  -
  -    // TODO: would like not to clone the locator...
  -     // but it may not be serializable, and it may be changed after being
  -     // passed in.
  -    if(null != locator)
  -      m_locator = new 
org.apache.xalan.utils.SerializableLocatorImpl(locator); 
  +    m_locator = locator; 
         
       m_patternString = exprString;
   
  @@ -261,8 +259,12 @@
       }
       catch (Exception e)
       {
  -      if (e instanceof org.apache.trax.TransformException)
  -        throw (org.apache.trax.TransformException) e;
  +      if (e instanceof javax.xml.transform.TransformerException)
  +      {
  +        TransformerException te = (TransformerException)e;
  +        throw new SAXParseException(te.getMessage(), 
  +          (SAXSourceLocator)te.getLocator(), e);
  +      }
         else
         {
           while (e instanceof org.apache.xalan.utils.WrappedRuntimeException)
  @@ -270,8 +272,8 @@
             e = ((org.apache.xalan.utils.WrappedRuntimeException) 
e).getException();
           }
   
  -        throw new org.apache.trax.TransformException("Error in XPath",
  -                m_locator, e);
  +        throw new SAXParseException("Error in XPath",
  +                (SAXSourceLocator)m_locator, e);
         }
       }
       finally
  @@ -484,7 +486,7 @@
       {
   
         // TO DO: Need to get stylesheet Locator from here.
  -      ehandler.warning(new TransformException(fmsg));
  +      ehandler.warning(new SAXParseException(fmsg, 
(SAXSourceLocator)xctxt.getSAXLocator()));
       }
     }
   
  @@ -528,16 +530,18 @@
   
       String fmsg = XSLMessages.createXPATHMessage(msg, args);
       ErrorHandler ehandler = xctxt.getPrimaryReader().getErrorHandler();
  -    TransformException te = new TransformException(fmsg,
  -                              xctxt.getSAXLocator());
   
       if (null != ehandler)
  -      ehandler.fatalError(te);
  +    {
  +      ehandler.fatalError(new SAXParseException(fmsg,
  +                              (SAXSourceLocator)xctxt.getSAXLocator()));
  +    }
       else
       {
  -      System.out.println(te.getMessage() + "; file " + te.getSystemId()
  -                         + "; line " + te.getLineNumber() + "; column "
  -                         + te.getColumnNumber());
  +      SourceLocator slocator = xctxt.getSAXLocator();
  +      System.out.println(fmsg + "; file " + slocator.getSystemId()
  +                         + "; line " + slocator.getLineNumber() + "; column "
  +                         + slocator.getColumnNumber());
       }
     }
   
  
  
  
  1.10      +22 -18    xml-xalan/java/src/org/apache/xpath/XPathContext.java
  
  Index: XPathContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathContext.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XPathContext.java 2000/10/30 18:58:26     1.9
  +++ XPathContext.java 2000/11/03 23:28:14     1.10
  @@ -87,15 +87,22 @@
   import org.xml.sax.SAXException;
   import org.xml.sax.InputSource;
   import org.xml.sax.XMLReader;
  -import org.xml.sax.Locator;
  +import org.xml.sax.SAXParseException;
  +// import org.xml.sax.Locator;
   
   // TRaX imports
  -import org.apache.trax.URIResolver;
  -import org.apache.trax.TransformException;
  +import javax.xml.transform.URIResolver;
  +import javax.xml.transform.TransformerException;
  +import org.apache.xalan.utils.SAXSourceLocator;
  +import javax.xml.transform.sax.SAXSource;
  +import javax.xml.transform.dom.DOMSource;
   
   // Temporary!!!
   import org.apache.xalan.extensions.ExtensionsTable;
   
  +import javax.xml.transform.SourceLocator;
  +import javax.xml.transform.Source;
  +
   /**
    * <meta name="usage" content="advanced"/>
    * Default class for the runtime execution context for XPath.
  @@ -133,7 +140,7 @@
     public void reset(){}
   
     /** NEEDSDOC Field m_saxLocation          */
  -  Locator m_saxLocation;
  +  SourceLocator m_saxLocation;
   
     /**
      * NEEDSDOC Method setSAXLocator 
  @@ -141,7 +148,7 @@
      *
      * NEEDSDOC @param location
      */
  -  public void setSAXLocator(Locator location)
  +  public void setSAXLocator(SourceLocator location)
     {
       m_saxLocation = location;
     }
  @@ -152,7 +159,7 @@
      *
      * NEEDSDOC (getSAXLocator) @return
      */
  -  public Locator getSAXLocator()
  +  public SourceLocator getSAXLocator()
     {
       return m_saxLocation;
     }
  @@ -373,23 +380,20 @@
     public final String getAbsoluteURI(String urlString, String base)
             throws SAXException
     {
  -
  -    InputSource inputSource;
  -
       try
       {
  -      inputSource = getSourceTreeManager().resolveURI(base, urlString,
  -              getSAXLocator());
  +      Source source = getSourceTreeManager().resolveURI(base, urlString,
  +                                                        getSAXLocator());
  +      return source.getBaseID();
       }
  +    catch (TransformerException te)
  +    {
  +      throw new SAXException(te);
  +    }
       catch (IOException ioe)
       {
  -      inputSource = null;  // shutup compiler.
  -
         throw new SAXException(ioe);
       }
  -
  -    // System.out.println("url: "+url.toString());
  -    return inputSource.getSystemId();
     }
   
     /** NEEDSDOC Field m_XSLMessages          */
  @@ -412,10 +416,10 @@
       if (errorHandler != null)
       {
         errorHandler.fatalError(
  -        new TransformException(
  +        new SAXParseException(
             m_XSLMessages.createMessage(
               XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION,
  -            new Object[]{ msg })));
  +            new Object[]{ msg }), (SAXSourceLocator)this.getSAXLocator()));
       }
     }
   
  
  
  
  1.3       +4 -2      xml-xalan/java/src/org/apache/xpath/XPathFactory.java
  
  Index: XPathFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XPathFactory.java 2000/10/30 18:58:27     1.2
  +++ XPathFactory.java 2000/11/03 23:28:14     1.3
  @@ -56,10 +56,12 @@
    */
   package org.apache.xpath;
   
  -import org.xml.sax.Locator;
  +// import org.xml.sax.Locator;
   
   import org.apache.xalan.utils.PrefixResolver;
   
  +import javax.xml.transform.SourceLocator;
  +
   /**
    * <meta name="usage" content="advanced"/>
    * Factory class for creating an XPath.  Implementors of XPath derivatives
  @@ -78,6 +80,6 @@
      *
      * NEEDSDOC ($objectName$) @return
      */
  -  XPath create(String exprString, Locator locator,
  +  XPath create(String exprString, SourceLocator locator,
                  PrefixResolver prefixResolver, int type);
   }
  
  
  
  1.8       +2 -1      
xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java
  
  Index: LocPathIterator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LocPathIterator.java      2000/11/02 22:42:59     1.7
  +++ LocPathIterator.java      2000/11/03 23:28:15     1.8
  @@ -100,7 +100,8 @@
    * in which case the UnionPathIterator will cache the nodes.</p>
    */
   public class LocPathIterator extends Expression
  -        implements Cloneable, NodeIterator, ContextNodeList, NodeList, 
java.io.Serializable 
  +  implements Cloneable, NodeIterator, 
  +  ContextNodeList, NodeList, java.io.Serializable 
   {
   
     /** NEEDSDOC Field m_pool          */
  
  
  
  1.10      +19 -10    
xml-xalan/java/src/org/apache/xpath/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/Compiler.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Compiler.java     2000/11/01 00:20:59     1.9
  +++ Compiler.java     2000/11/03 23:28:16     1.10
  @@ -86,11 +86,14 @@
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xalan.utils.QName;
   import org.apache.xalan.utils.PrefixResolver;
  -import org.apache.trax.ProcessorException;
  +import javax.xml.transform.TransformerConfigurationException;
  +import javax.xml.transform.SourceLocator;
  +import org.apache.xalan.utils.SAXSourceLocator;
   
   import org.xml.sax.ErrorHandler;
  -import org.xml.sax.Locator;
  +// import org.xml.sax.Locator;
   import org.xml.sax.SAXException;
  +import org.xml.sax.SAXParseException;
   
   import org.w3c.dom.traversal.NodeFilter;
   
  @@ -108,7 +111,7 @@
      * NEEDSDOC @param errorHandler
      * NEEDSDOC @param locator
      */
  -  public Compiler(ErrorHandler errorHandler, Locator locator)
  +  public Compiler(ErrorHandler errorHandler, SourceLocator locator)
     {
       m_errorHandler = errorHandler;
       m_locator = locator;
  @@ -1061,9 +1064,14 @@
   
       if (null != m_errorHandler)
       {
  -
  -      // TO DO: Need to get stylesheet Locator from here.
  -      m_errorHandler.warning(new ProcessorException(fmsg));
  +      m_errorHandler.warning(new SAXParseException(fmsg, 
(SAXSourceLocator)m_locator));
  +    }
  +    else
  +    {
  +      System.out.println(fmsg
  +                          +"; file "+m_locator.getSystemId()
  +                          +"; line "+m_locator.getLineNumber()
  +                          +"; column "+m_locator.getColumnNumber());
       }
     }
   
  @@ -1103,10 +1111,11 @@
     {
   
       java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args);
  -    ProcessorException te = new ProcessorException(fmsg, m_locator);
   
       if (null != m_errorHandler)
  -      m_errorHandler.fatalError(te);
  +    {
  +      m_errorHandler.fatalError(new SAXParseException(fmsg, 
(SAXSourceLocator)m_locator));
  +    }
       else
       {
   
  @@ -1114,7 +1123,7 @@
         //                    +"; file "+te.getSystemId()
         //                    +"; line "+te.getLineNumber()
         //                    +"; column "+te.getColumnNumber());
  -      throw te;
  +      throw new SAXParseException(fmsg, (SAXSourceLocator)m_locator);
       }
     }
   
  @@ -1147,5 +1156,5 @@
     ErrorHandler m_errorHandler;
   
     /** NEEDSDOC Field m_locator          */
  -  Locator m_locator;
  +  SourceLocator m_locator;
   }
  
  
  
  1.5       +5 -3      
xml-xalan/java/src/org/apache/xpath/compiler/XPathParser.java
  
  Index: XPathParser.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/XPathParser.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XPathParser.java  2000/10/30 18:59:26     1.4
  +++ XPathParser.java  2000/11/03 23:28:16     1.5
  @@ -69,9 +69,11 @@
   
   import org.xml.sax.ErrorHandler;
   import org.xml.sax.SAXException;
  +import org.xml.sax.SAXParseException;
   import org.xml.sax.Locator;
  +import org.xml.sax.helpers.LocatorImpl;
   
  -import org.apache.trax.ProcessorException;
  +import javax.xml.transform.TransformerConfigurationException;
   
   /**
    * <meta name="usage" content="general"/>
  @@ -536,7 +538,7 @@
       {
   
         // TO DO: Need to get stylesheet Locator from here.
  -      ehandler.warning(new ProcessorException(fmsg, (Locator) null));
  +      ehandler.warning(new SAXParseException(fmsg, new LocatorImpl()));
       }
       else
       {
  @@ -583,7 +585,7 @@
       {
   
         // TO DO: Need to get stylesheet Locator from here.
  -      ehandler.fatalError(new ProcessorException(fmsg, (Locator) null));
  +      ehandler.fatalError(new SAXParseException(fmsg, new LocatorImpl()));
       }
       else
       {
  
  
  
  1.7       +1 -1      xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java
  
  Index: XNodeSet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XNodeSet.java     2000/10/30 19:00:24     1.6
  +++ XNodeSet.java     2000/11/03 23:28:16     1.7
  @@ -229,7 +229,7 @@
   
       return frag;
     }
  -
  +  
     /**
      * Cast result object to a nodelist.
      *
  
  
  
  1.4       +1 -1      
xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources.java
  
  Index: XPATHErrorResources.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XPATHErrorResources.java  2000/10/30 19:00:57     1.3
  +++ XPATHErrorResources.java  2000/11/03 23:28:17     1.4
  @@ -475,7 +475,7 @@
     static
     {
       contents[ER_COULDNOT_CREATE_XMLPROCESSORLIAISON][1] =
  -      "Could not create XML Processor Liaison: {0}";
  +      "Could not create XML TransformerFactory Liaison: {0}";
     }
   
     /** NEEDSDOC Field ER_DIDNOT_FIND_XPATH_SELECT_EXP          */
  
  
  

Reply via email to