Bernice
Bernice

Reputation: 2592

Run XSLT file directly in browser - Eclipse IDE

I am trying my first XSLT transformation. I wrote a simple XML file and a simple XSL file which lists elements in a table. I created the files using the eclipse IDE and the transformation was complete to XML. i.e. I got an out.xml file which contained the corresponding html code correctly. How can I run this file on the server to view the output of the html file on the browser instead?

Is there a way of specifying to the XSL file to open in the browser? maybe in the href part where I link the XML with the XSL?

I tried this:

<?xml-stylesheet type="text/xsl" href="http://8089/Transformations/BookStore.xsl"?>

where 8089 is the port where I am running my tomcat server, Transformations is the name of the project and BookStore.xsl is the XSL stylesheet.

However after doing that, it's still opening in the file. Am I doing something wrong?

Thanks :)

Upvotes: 0

Views: 1277

Answers (1)

C. M. Sperberg-McQueen
C. M. Sperberg-McQueen

Reputation: 25044

If Tomcat is listening on port 8089, the URL should look something like

http://localhost:8089/Transformations/BookStore.xsl

It can often be simpler to use a relative URI to point at the XSLT from the XML, if you know the relative locations of the two.

Upvotes: 2

Related Questions