Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 07:08 AM
Lincoln Cooper
Guest
 
Posts: n/a
Default JSP/JAVA Dynamic Client side XSLT

Hi,

I'm having a problem getting client-side XSLT to work. I'm using IE6
and JAVA/JSP. Obviously, when I use an XML file with the name of the
xsl template embeded in it (as a tag) all works fine.

The problem is that I'm creating the XML dynamically from JAVA classes
(using Betwixt which seems very good) and thus have my XML not as a
file but as a string. When I try and output this String from a JSP,
the browser doesn't recognise that it is an XML file but thinks it's
HTML so I get the values of the tags printed instead of the XSLT.

I've tried the following methods:

1)
String outStr = "<?xml version='1.0'?><?xml-stylesheet type='text/xsl'
href='templ.xsl'?><roottag><name>fred</name></roottag>";
out.print(outStr);


2)
String outStr = "<?xml version='1.0'?><?xml-stylesheet type='text/xsl'
href='templ.xsl'?><roottag><name>fred</name></roottag>";
PrintWriter pw = response.getWriter();
pw.write(outStr);


3)
String outStr = "<?xml version='1.0'?><?xml-stylesheet type='text/xsl'
href='templ.xsl'?><roottag><name>fred</name></roottag>";
response.setContentType("text/xsl");
ServletOutputStream sos = response.getOutputStream();
sos.print(outStr);


Any ideas on the syntax that WILL work???

Thanks!
Lincoln.
  #2  
Old July 20th, 2005, 07:09 AM
Lincoln Cooper
Guest
 
Posts: n/a
Default Re: JSP/JAVA Dynamic Client side XSLT

OK - It works now... the syntax is...


String outStr = "<?xml version='1.0'?><?xml:stylesheet type='text/xsl'
href='templ.xsl'?><roottag><name>fred</name></roottag>";
out.print(outStr);


The stylesheet tag should be "xml:stylesheet" and NOT "xml-stylesheet". Doh!!


Lincoln.
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles