// This method applies the xslFilename to inFilename and writes
// the output to outFilename.
String inFilename = "C:\\Documents and Settings\\Adrian Ron\\Start Menu\\Programs\\Apache Tomcat 4.1\\xmlfile.xml";
String xslFilename = "xsl";
// Writer out;
// Use the factory to create a template containing the xsl file
Templates template = factory.newTemplates(new StreamSource(
new FileInputStream(xslFilename)));
// Use the template to create a transformer
Transformer xformer = template.newTransformer();
// Prepare the input and output files
Source source = new StreamSource(new FileInputStream(inFilename));
Result result = new StreamResult(out);
// Apply the xsl file to the source file and write the result to the output file
xformer.transform(source, result);
} catch (FileNotFoundException e) {
} catch (TransformerConfigurationException e) {
// An error occurred in the XSL file
} catch (TransformerException e) {
// An error occurred while applying the XSL file
// Get location of error in input file
SourceLocator locator = e.getLocator();
int col = locator.getColumnNumber();
int line = locator.getLineNumber();
String publicId = locator.getPublicId();
String systemId = locator.getSystemId();
}
%>
i'd suggest not ignoring any exceptions so you know if something has gone wrong.
e.printStackTrace();
out.println("Error: "+e);
0
RonayneAuthor Commented:
nothing get displayed, just a blank page
0
The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.
One of a set of tools we're offering as a way of saying thank you for being a part of the community.
check those exceptions, i'm guessing one is getting thrown
if so, the exception should give u an indication of what the problem is.
perhaps it's not finding the xsl file.
0
RonayneAuthor Commented:
Well I did'nt create an xsl file, could you guide me as to what I need to do so I can open the xml document with a stylesheel and display it as an html document?
0
RonayneAuthor Commented:
Im trying to work off thsi tutorial which I think is sufficient for what I want to do.
Thanks for that, im working off this: http://www.w3schools.com/xsl/xsl_transformation.asp. The server will be accessing the xml file on the clients computer and transforming it to html on the clients computer. Here is what I came up with. Can I just put the xml style sheet in a tomcat directory, is this line ok: <?xml-stylesheet type="text/xsl" href="localhost:8080\cdcatalog.xsl"?>. Ill increase the points.