You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Schot, P.J.N. van der" <P....@DLG.agro.nl> on 2001/03/23 08:06:34 UTC

StreamSource Problem

Hi all,

Can somebody help me with the following problem. I'm trying to apply XSL to
a XML. I'm using a bean, which i'm calling from a JSP page, with the
following code:

	public String transform()
	{
	  try
	  {
	      // 1. Instantiate a TransformerFactory.
	      TransformerFactory tFactory =
TransformerFactory.newInstance();
	      // 2. Use the TransformerFactory to process the stylesheet
Source and
	      //    generate a Transformer.
	      Transformer transformer = tFactory.newTransformer(new
StreamSource(new
URL("http://dlgutr0939bwnt/Intra/showAfd.xsl").openStream()));
	      // 3. Use the Transformer to transform an XML Source and send
the
	      //    output to a Result object.
		    ByteArrayOutputStream stream = new
ByteArrayOutputStream();
	  		PrintWriter pw = new PrintWriter(stream);
	      transformer.transform
	              (new StreamSource(new
URL("http://dlgutr0939bwnt/Intra/showAfd.xml").openStream()),
	               new StreamResult(pw));
	      document = stream.toString();
	  }
	  catch(Exception e)
	  {
	      document = "Error in xsl processing:" + e.toString();
	  }
	  return document;
	}

This script is working fine when i'm not using security in Apache. Turning
security on results into the following error message:

	Error in xsl processing:java.io.FileNotFoundException:
http://dlgutr0939bwnt/Intra/showAfd.xsl 

Has anyone an idea to solve this problem?

Thanx

Patrick