wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes What can be the problem with this relative path? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "What can be the problem with this relative path?" Watch "What can be the problem with this relative path?" New topic
Author

What can be the problem with this relative path?

Thomas Kennedy
Ranch Hand

Joined: Jan 20, 2008
Posts: 137
I have a JSP as follows, running on WebSphere 6.1 in RAD 7.0.0.6:


The xsl contains an import as follows:

<xsl:import href="../content.xsl"/>

While it seems to find the software_content.xsl OK, I get the following exception when it tries to find the imported sheet:

Had IO Exception with stylesheet file: ../content.xsl

I'm a little baffled that it can find my software_content.xsl but not find the content.xsl one folder up. Is there some simple answer here?


Costs matter. Justice lies in processes not outcomes. Crime is caused by criminals.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I'm just guessing here, but Java has often had trouble in the past with URLs which are file:// URLs where the path name contains spaces. In fact I vaguely recall that I had to URL-encode the path name (i.e. replace the spaces by %20.) when I was dealing with XSLT and importing, but it was several years ago. You also have an ampersand in your path name: that seems like another risky idea in this context, but anyway that would have to be URL-encoded as well.

(That's a simple answer but it might not be a correct answer.)
Thomas Kennedy
Ranch Hand

Joined: Jan 20, 2008
Posts: 137
Right, the spaces and so on. I did clean that up but, strangely, that made no difference.

I wonder if RAD is enforcing its context path even in xslt, so that the relative url is not relative to the current xsl sheet but is relative to whatever the context path is.

Finally I just put an absolute path -- like file:///c:/temp/foo -- in both places, the JSTL:import and the import. I will come back to this later.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: What can be the problem with this relative path?