L
Lincoln Cooper
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.
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.