I'm using Xerces 1.4.2 and Xalan-j_2_2_D to transform an XML file into
two smaller XML files, but for some reason during the transformation, it
only parses the root directory, then quits.  I ran into this problem
before and upgrading to the latest Xerces fixed it (1.3.1), but even
upgrading further doesn't seem to help this time.  I'd appreciate any
suggestions as this used to work, but now I'm transporting to a new
server and this problem is cropping up again (and I have to demo it on
Thursday!)

The servlet is as follows:

// Imported TraX classes
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;


// Imported java classes
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 *  Use the TraX interface to perform a transformation in the simplest
manner possible
 *  (3 statements).
 */
public class SimpleTransform2
{
        public static void main(String args[])
        {
        }

        public void transform(String xmlFile, String xslFile, String outFile)
    throws TransformerException, TransformerConfigurationException, 
           FileNotFoundException, IOException
  {  

        System.out.println("Entering transform");
        System.out.println("xmlFile is " + xmlFile);
        System.out.println("xslFile is " + xslFile);
        System.out.println("outFile is " + outFile);
  // Use the static TransformerFactory.newInstance() method to
instantiate 
  // a TransformerFactory. The javax.xml.transform.TransformerFactory 
  // system property setting determines the actual class to instantiate
--
  // org.apache.xalan.transformer.TransformerImpl.

        TransformerFactory tFactory = TransformerFactory.newInstance();
        
        // Use the TransformerFactory to instantiate a Transformer that will
work with  
        // the stylesheet you specify. This method call also processes the
stylesheet
  // into a compiled Templates object.

        Transformer transformer = tFactory.newTransformer(new
StreamSource(xslFile));

        // Use the Transformer to apply the associated Templates object to an
XML document
        // (foo.xml) and write the output to a file (foo.out).

        transformer.transform(new StreamSource(xmlFile), new StreamResult(new
FileOutputStream(outFile)));
        
        //System.out.println("************* The result is in " + outFile +
"*************");
  }
}

Here is the document I'm getting when it's finished:

<?xml version="1.0" encoding="UTF-8"?>
<ROWSET xmlns:fo="http://www.w3.org/1999/XSL/Format"/>

I'm using JRun 2.3.3 as the servlet engine.

Karen Fox
The MITRE Corporation
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to