When using a relative URL for the xsltUrl attribute, e.g. test.jsp: <x:transform xsltUrl="test.xsl">SOME CONTENT</x:transform> even if there exists a test.xsl in the same deploy directory as test.jsp, the following error results: javax.servlet.jsp.JspTagException: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: java.io.FileNotFoundException: What is particularly interesting is the file that it's looking for: It seems to prepend my _development_ directory to the path. E.g. I use the standard Tomcat 4.0 recommended development directory format: <DEVEL>/test-jstl/web/test.[jsp|xsl] and deploy to tomcat's webapps directory: <TOMCAT>/webapps/test-jstl/test.[jsp|xsl] Then the actual error which results when I try loading test.jsp is: java.io.FileNotFoundException: <DEVEL>/test-jstl/test.xsl If I modify test.jsp to contain: <x:transform xsltUrl="web/test.xsl"> Then it actually finds the file, and works mod the following error. For some reason if test.xsl contains the standard header: <?xml version="1.0"?> I get the error: org.xml.sax.SAXParseException: The XML declaration may only appear at the very beginning of the document. If I eliminate the xml declaration and start with: <xsl:stylesheet version= ... > Then everything works as expected.
I figured out at least some more what is going on. When the URL specified in xsltUrl is relative, the actual path searched is sensitive to _where catalina is started from_. I.e., if I do: cd <DEVEL> catalina start Then I get: java.io.FileNotFoundException: <DEVEL>/test.xsl If I do: cd <TOMCAT>/webapps/test-jstl/ catalina start Then things "work".
Created attachment 1430 [details] Here's an ugly hack that "fixes" this problem
Many thanks for this report. Because of problems like this, the spec was updated and now offers a different approach for handling XML documents with relative system identifiers. The new approach is more general and more consistent with JSTL's goal of simple, specific tags. Please read the PFD document available from jcp.org if you're interested in the new approach.