tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Tomcat 5.5 Xml + Xslt Question
Date Wed, 14 Feb 2007 21:45:35 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jim,

Jim Reynolds wrote:
> I am struggling with content types within a JSP page. I have an XML,
> XSLT and CSS file that combined are suposed to create a tree. (I am
> trying to get treeview to work).

I don't know a thing about treeview, but I might be able to help with
some other issues.

> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet type="text/css" href="treeview/treeview.css" ?>

You don't want this: xml-stylesheet is for XSLTs only, not CSS files. If
you want to include a CSS file with your web page, you're going to have
to make sure that the (HTML) content emitted to the browser contains a
"<link rel="stylesheet" href="treeview/treeview.css" />" element.

> <?xml-stylesheet type="text/xsl" href="treeview/treeview.xslt" ?>

This directive will instruct the browser to transform the current
document (the one for which you provided the source) using
"treeview/treeview.xslt".

JSP will not automatically transform your XML document, but the browser
should. It will download the XSLT and transform your document -- I
assume into HTML. I can't tell what your XSLT does.

In terms of the CSS stylesheet, your XSLT should probably emit the
<link> element required to get the browser to use that stylesheet.

I recommend that you take a step back.

Take the file you posted, along with the CSS And XSLT files, ad just try
to get it working on your local machine. There's no need to have a web
server and JSP runner confusing things.

Mozilla Firefox (and I think MSIE) will transform your XML document if
you just load it right off your local disk. Once that's working, /then/
you can throw JSP into the mix and start generating dynamic XML to be
transformed.

Some more free advice: if you want to do XSLT transformations, don't
rely on the browser to do them properly. I've seen some weird stuff when
ff transforms XML, sometimes resulting in errors which make the page
unusable. Also, you can never detect errors that occur in the browser,
so you might never know anything is wrong unless you get angry calls
from customers.

I highly recommend Cocoon, which was designed to do nothing but
transform XML using easily defined pipelines that can do some amazing
things.

Just me $0.02.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF04L/9CaO5/Lv0PARAlqBAJ4tFfLDHN6R/9r6/Tfe2sN4RUUbBQCeOSvX
OY5338UknX5KcEeqOm7ymvQ=
=QMkV
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message