You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Houghton, Michael" <mi...@roke.co.uk> on 2001/02/16 11:32:14 UTC

XML Transform

Hello,

I'm using the latest Xalan for Java along with Xerces1.2.3. I have Tomcat 3.2.1 along with the most recent stable Apache for Win32. I'm developing on Win200 prof.
My development environment in JBuilder 4 with JDK1.3

I have one class  SimpleTransform(String url, String xslSheet)

--------------------
.... It loads the  XML sheet from the url and  loads the style sheet from xslSheet 
.... Transforms and dumps to the specified file. 
.... If I run this within JBuilder it works fine
...
... If I create servlet within Tomcat and this servlet creates a SimpleTransform object and calls transform I get

	javax.xml.transform.TransformerConfigurationException: Namespace not supported by SAXParser

I use exactly the same url and xslSheet in the servlet as in the standalone version. The classpath within Tomcat is the same as in the
JBuilder execution environment.

I'm quite confused and any comments would be appreciated.

Many thanks

Mike


....

 public void transform()
  {
     try
    {
      TransformerFactory tFactory = TransformerFactory.newInstance();

      // Use the TransformerFactory to instantiate a Transformer that will work with
      // the stylesheet specified. This method call also processes the stylesheet
      // into a compiled Templates object.
      StreamSource strm = new StreamSource(xslSheet );

      Transformer transformer = tFactory.newTransformer(strm);

      // 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(url), new StreamResult(new FileOutputStream("cctOut.html")));
      System.out.println("************* The result is in cctOut.html *************");
    }
    catch(TransformerConfigurationException tce){System.out.println(tce);}
    catch(TransformerException te){System.out.println(te);}

    catch(FileNotFoundException fnfe){System.out.println(fnfe);}
    catch(IOException ioe){System.out.println(ioe);}

  }


---



Dr Mike Houghton
Consultant Engineer 
Internet Technologies & Networks
Roke Manor Research (  http://www.roke.co.uk/  )

email michael.houghton@roke.co.uk