• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet, XML response and XSL

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have written a Servlet, which is suppose to write xml as its response. The client (often a browser) is then supposed to transform the xml into html using a xsl stylesheet.
The Servlet code:

My problem is, that I want to include a reference to the stylesheet in the xml document (see above) and place the style sheet on the same webserver as the servlet.
How do I reference the stylesheet and how do I make it available on the webserver. (as well as how do I make a html file available on the webserver)???
Hope this question is understandable.
regards
Jesper
[ October 16, 2003: Message edited by: Mark Spritzler ]
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jesper, I have edited your post to include the CODE tag, so that your code is readable. In our Forums there is a button under the ADD REPLY button that says CODE. This button will place CODE tags where you can post your code and keep all your formatting, including indentation, which is paramount to readability. Next time, please use the CODE tag to post code.
OK, now to you question. In my Servlets where I am using XML and XSLT, I convert the XML to HTML on the server side, so I am always passing HTML back to the client. I did not know that a client can do this, or think that a client can do this. But I could be wrong there.
Here is code from my Servlet (two methods) that transforms the XML document into HTML using XSLT.

Now there are some pieces missing that are variables defined elsewhere, but the code is to give you the idea of how to use the Transformer class.
Here are three import statements that you will need

I hope this helps you to find out more information, so that you can learn a bit better through experience.
Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic