Re: [xsl] Problem with transforming using Xalan: "Had IO Exception with stylesheet file"

Subject: Re: [xsl] Problem with transforming using Xalan: "Had IO Exception with stylesheet file"
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 12 Oct 2007 23:43:34 +0200
Chaudhary, Harsh wrote:
Had IO Exception with stylesheet file: Could not find file
math.max.template.xsl

Anyone have any views on that?

Another thing, if I use the full path to the file like so:

<xsl:import
href="C:\harsh\ws\wsad\JavaSource\com\amfam\rate\xml\math.max.template.x
sl" />

Actually, this is not a URI, so practically this last method should've thrown an error too. That it does work, is pure luck and non-conformance of Xalan (and won't be portable with other processors). Instead, try to restrict yourself to a URI form like: href="file:///c:/harsh/ws/etc/etc/etc/xml/math.max.template.xsl"


If you load the stylesheet from disk or from memory, the original stylesheet may loose the base href it is originally loaded from. This is the system id that George is referring to. All xsl:import, xsl:include and document(...) references are resolved relative to this base system id. If you use Java, you are probably able to set this system id programmatically. Otherwise, you can try to start your program from a certain location and make all the paths relative to this (i.e., load your Java from the bin directory and your sources from "../../resources/xslt" will work if that is the relative path of your xslt sources from your bin directory.

Cheers,
-- Abel Braaksma

Current Thread