Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What can be the problem with this relative path?

 
Thomas Kennedy
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Paul Clapham
Sheriff
Posts: 21316
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic