You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Caton, Paul" <Pa...@brown.edu> on 2002/12/02 22:36:50 UTC

Not getting CSS with XML

I'd be very grateful for any advice regarding a CSS problem that is
puzzling me.

Our setup is Tomcat 4.0.6-LE on a Sun running Solaris 8.

We have a webapp with the href base set as /acsam.

In the acsam webapp directory we have this very simple test CSS
stylesheet (mary.css):


paragraph {

	display: block;

	border: solid red;

	line-height: 2

}

.green {color: green}

We also have a simple html file (mary.html):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" SYSTEM
"http://www.w3.o
rg/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>CSS Test</title>
<link rel="stylesheet" type="text/css" href="/acsam/mary.css"/>
</head>
<body>
<div>
<p class="green">Mary had a little lamb.</p>
</div>
</body>
</html>

If we access this file directly (ie. [path]/acsam/mary.html) it displays
correctly - the text is green as dictated by the mary.css stylesheet.
Similarly, if we access mary.html by using an include statement in a
JSP, like this (mary2.jsp):

<%@ include file="mary.html" %>

it displays correctly as before.

Now to the XML. We have a simple XML file (mary.xml):

<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type="text/css" href="/acsam/mary.css"?>
<document>
<paragraph>
Mary had a little lamb.
</paragraph>
</document>

If we access this file directly (ie. [path]/acsam/mary.xml) it displays
correctly, with a red border around the paragraph, as dictated by the
mary.css stylesheet. However (here's the puzzling part), when we try to
access mary.xml with a very simple JSP file like this (mary.jsp):

<%@ include file="mary.xml" %>

it does NOT display correctly. For some reason the <?xml-stylesheet?>
link is not getting the CSS, even though it does get it when we access
the XML file directly. As you can see, the path to the CSS file is the
same in both mary.html and mary.xml.

Can anyone explain why accessing the XML via the JSP doesn't get us the
CSS styles?

Thanks,

Paul.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>