Bug 7500 - xsltUrl attr for x:transform
Summary: xsltUrl attr for x:transform
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.0B1
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2002-03-26 21:07 UTC by daishi
Modified: 2004-11-16 19:05 UTC (History)
0 users

Here's an ugly hack that "fixes" this problem (1.88 KB, patch)
2002-03-27 02:02 UTC, daishi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description daishi 2002-03-26 21:07:35 UTC
When using a relative URL for the xsltUrl attribute, e.g.
	<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.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:
and deploy to tomcat's webapps directory:

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.
Comment 1 daishi 2002-03-26 22:11:44 UTC
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".
Comment 2 daishi 2002-03-27 02:02:09 UTC
Created attachment 1430 [details]
Here's an ugly hack that "fixes" this problem
Comment 3 Shawn Bayern 2002-04-17 20:28:55 UTC
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.