You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Garey <gm...@library.berkeley.edu> on 2007/06/13 01:43:52 UTC

Problem with XSL stylesheet not being applied when XML served through Tomcat

Here are two URLs

http://library11.berkeley.edu/~gmills/binds_result.xml 
<http://library11.berkeley.edu/%7Egmills/binds_result.xml>

http://library11.berkeley.edu:8080/...inds_result.xml 
<http://library11.berkeley.edu:8080/noidbind/binds_result.xml>


In Firefox 2, the first URL results in the XSL stylesheet referenced in 
the XML document being applied correctly. The second URL does not. The 
difference is that the first URL is being served by Apache httpd 1.3.X, 
and the second by Tomcat 6.0.

This document was generated dynamically by the app at noidbind. When I 
generate the document, I set the mimetype of the document to 'text/xml' 
and that also fails to work.

All of these work in IE.

Can anyone tell me what I have to do to fix this, and get the stylesheet 
applied when the document is served by Tomcat?

Thanks;

Garey Mills

---------------------------------------------------------------------
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


Re: Problem with XSL stylesheet not being applied when XML served through Tomcat

Posted by Richard Kaye <R....@bham.ac.uk>.
Interesting, and I don't know the answer. Doesn't sound
like it's an issue with the mimetype of the main document.

One small point is that you load your stylesheet with
 <?xml-stylesheet type="text/xsl" href="..." ?>
but the server provides it as "application/xml".
AFAIK "text/xsl" was never registered and so you might try
"text/xml" or "application/xml" instead.  If this doesn't 
work you could even try application/xslt+xml, or try 
tinkering with the mimetype of the stylesheet as served 
up by your Apache/1.3.33 that serves the XSL.

But I don't see why it should work in one case and not in the
other. (But that is what I get when I try it in epiphany.)

Richard



On Tue, 2007-06-12 at 16:43 -0700, Garey wrote:
> Here are two URLs
> 
> http://library11.berkeley.edu/~gmills/binds_result.xml 
> <http://library11.berkeley.edu/%7Egmills/binds_result.xml>
> 
> http://library11.berkeley.edu:8080/...inds_result.xml 
> <http://library11.berkeley.edu:8080/noidbind/binds_result.xml>
> 
> 
> In Firefox 2, the first URL results in the XSL stylesheet referenced in 
> the XML document being applied correctly. The second URL does not. The 
> difference is that the first URL is being served by Apache httpd 1.3.X, 
> and the second by Tomcat 6.0.
> 
> This document was generated dynamically by the app at noidbind. When I 
> generate the document, I set the mimetype of the document to 'text/xml' 
> and that also fails to work.
> 
> All of these work in IE.
> 
> Can anyone tell me what I have to do to fix this, and get the stylesheet 
> applied when the document is served by Tomcat?
> 
> Thanks;
> 
> Garey Mills
> 
> ---------------------------------------------------------------------
> 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
> 


---------------------------------------------------------------------
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


Re: Problem with XSL stylesheet not being applied when XML served through Tomcat

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Robert Koberg wrote:

> I don't know about konqueror, but Safari supports it. Safari does not
> have an interface to apply transformations with JS, however. And Opera
> does not support the document function. Though I tend not to like using
> a PI in the source XML to trigger the transform (can't cache the
> processor object, tying the style to the source, etc...), it is a widely
> supported and easy way to go. If konqueror can't do it, it is probably
> the only 'modern' browser that doesn't.

Well, client-sided XSLT may widely supported, and, in fact, it may even
be just my konqueror that doesn't do it due to some misconfiguration (I
don't care enough to try and find out for sure).
Nevertheless, if done on the server side, there is no need to spend a
single thought about how good or bad pontential clients might support
XSLT. They simply have to render the result - which alone can give one
enough to think about if it shall look identical on different browsers.
That's why IMO XSLT belongs in most cases to the server side.
Of course, everyone has to decide for himself and consider his own
requirements.

Regards
  mks

---------------------------------------------------------------------
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


Re: Problem with XSL stylesheet not being applied when XML served through Tomcat

Posted by Robert Koberg <ro...@koberg.com>.
On Wed, 2007-06-13 at 13:00 +0200, Markus Schönhaber wrote:
> 
> Another comment targeted @ the OP: IMO XSL transformations should be
> done on the server side, not on the client side. Doing it on the client
> side may be OK if you have a very specific user base and you can be sure
> that their clients support XSLT. If you target a more general audience,
> you'll propably exclude some potential users because their clients won't
> apply the stylesheet. For example, my konqueror doesn't - and since
> AFAIR Safari is based on the same foundation as konqueror, it propably
> won't either.

I don't know about konqueror, but Safari supports it. Safari does not
have an interface to apply transformations with JS, however. And Opera
does not support the document function. Though I tend not to like using
a PI in the source XML to trigger the transform (can't cache the
processor object, tying the style to the source, etc...), it is a widely
supported and easy way to go. If konqueror can't do it, it is probably
the only 'modern' browser that doesn't.

best,
-Rob


---------------------------------------------------------------------
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


Re: Problem with XSL stylesheet not being applied when XML served through Tomcat

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Owen Rees wrote:

> --On Wednesday, June 13, 2007 11:27:45 AM +0200 Markus Schönhaber
> wrote:
> 
>> I don't think this has anything to do with Tomcat. It rather seems
>> to me that Firefox loads and applies the XSL if the URL referencing
>> it points to the same server(?) / base URL (?) the XML file comes
>> from. Drop the XSL into the Tomcat webapp and modify the XML source
>> (or our code generating it) to reference it from there. Then it
>> will propably be applied. If you find out whether this is a
>> documented feature of Firefox or simply a bug, please let me know.
> 
> <http://developer.mozilla.org/en/docs/XSL_Transformations_in_Mozilla_FAQ>
> 
> 
> At the end of the "Why isn't my stylesheet applied?" section it says:
>  "Mozilla won't load XSLT stylesheets from a different domain for
> security reasons."

Thanks for the pointer, Owen!

Another comment targeted @ the OP: IMO XSL transformations should be
done on the server side, not on the client side. Doing it on the client
side may be OK if you have a very specific user base and you can be sure
that their clients support XSLT. If you target a more general audience,
you'll propably exclude some potential users because their clients won't
apply the stylesheet. For example, my konqueror doesn't - and since
AFAIR Safari is based on the same foundation as konqueror, it propably
won't either.

Regards
  mks


---------------------------------------------------------------------
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


Re: Problem with XSL stylesheet not being applied when XML served through Tomcat

Posted by Owen Rees <ow...@hp.com>.
--On Wednesday, June 13, 2007 11:27:45 AM +0200 Markus Schönhaber wrote:

> I don't think this has anything to do with Tomcat. It rather seems to me
> that Firefox loads and applies the XSL if the URL referencing it points
> to the same server(?) / base URL (?) the XML file comes from.
> Drop the XSL into the Tomcat webapp and modify the XML source (or our
> code generating it) to reference it from there. Then it will propably be
> applied.
> If you find out whether this is a documented feature of Firefox or
> simply a bug, please let me know.

<http://developer.mozilla.org/en/docs/XSL_Transformations_in_Mozilla_FAQ>

At the end of the "Why isn't my stylesheet applied?" section it says: 
"Mozilla won't load XSLT stylesheets from a different domain for security 
reasons."

-- 
Owen Rees; speaking personally, and not on behalf of HP.
========================================================
Hewlett-Packard Limited.   Registered No: 690597 England
Registered Office:  Cain Road, Bracknell, Berks RG12 1HN

---------------------------------------------------------------------
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


Re: Problem with XSL stylesheet not being applied when XML served through Tomcat

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Garey wrote:

> http://library11.berkeley.edu/~gmills/binds_result.xml 
> <http://library11.berkeley.edu/%7Egmills/binds_result.xml>
> 
> http://library11.berkeley.edu:8080/...inds_result.xml 
> <http://library11.berkeley.edu:8080/noidbind/binds_result.xml>
> 
> 
> In Firefox 2, the first URL results in the XSL stylesheet referenced in 
> the XML document being applied correctly. The second URL does not. The 
> difference is that the first URL is being served by Apache httpd 1.3.X, 
> and the second by Tomcat 6.0.

I don't think this has anything to do with Tomcat. It rather seems to me
that Firefox loads and applies the XSL if the URL referencing it points
to the same server(?) / base URL (?) the XML file comes from.
Drop the XSL into the Tomcat webapp and modify the XML source (or our
code generating it) to reference it from there. Then it will propably be
applied.
If you find out whether this is a documented feature of Firefox or
simply a bug, please let me know.

Regards
  mks

---------------------------------------------------------------------
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