tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Deikman <>
Subject Re: Trouble with XSL transforms with JSP
Date Mon, 31 Jan 2005 00:15:11 GMT
The error message you are getting I haven't seen before, but it seems 
that you have some text before the root element of your document.  This 
would be outside of the <? .. ?> elements.

Personally, I wrote a java class to do my XSL transforms.  My JSPs call 
them, so other than that there is nothing XSLT in the JSPs themselves. 
The alternative is to use JSTL tags to do XSLT, which I have avoided by 
doing this.


A. wrote:

>I have played with several versions of Tomcat, but now I have decided to study JSP in
earnest and I downloaded the latest release two days ago. I have also upgraded my Java installation.
The installation went relatively well and Tomcat is running on my machine.
>I decided to start with something I know about, so I am attempting to transform an XML
document to an HTML page via JSP. For a sanity check, I have downloaded O'Reilly's source
code from JavaServer Pages, 3rd edition. Specifically, chapter 15 has an example of what I
wish to do. The example works flawlessly, but my transform coughs up this error message.
>"... org.xml.sax.SAXParseException: Content is not allowed in prolog."
>I have researched this to some degree and found that this class sometimes gags on UTF-8
files. I checked my XML document in the Hex view of my editor and saw that there indeed were
two bytes at the beginning of the file that were suggested as the source of my problem.
>So I wrote an XSLT identity transform stylesheet that reproduces the document while changing
the encoding from UTF-8 to ISO-8859-1. After running the transform of my XML document I checked
it in the Hex view of my editor and the encoding appears now to be ISO-8859-1. I re-wrote
my stylesheet so that its output encoding is ISO-8859-1 now also.
>Nonetheless, I still get the same exception message when I attempt the transform. Does
anyone know of a "cookbook" approach or checklist I can use to get over this hump? Thanks.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message