Hi,
I'm currently trying to clean up the code in Ant dealing with the <style>
task because it looks like there are users complaining from weird behaviors
depending on platforms.
It looks like the following bugs are related in Xalan:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1670
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=803
Those 2 one are of particular interest since they confirm my point:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2394
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2731
As of now in Ant the systemid was file: + file.getPath() which is not good
to me but was working quite well apparently. Personally I was used to do a
"file:///" + file.getAbsolutePath() and was ready to do it in xalan1 code
and use File in trax code...however...
When looking at Xalan source code I went trough the StreamResult in JAXP
that does:
public void setSystemId(File f) {
String fpath=f.getAbsolutePath();
if( fpath.startsWith("/"))
this.systemId= "file://" + fpath;
else
this.systemId = "file:///" + fpath;
}
When looking at TransformerImpl, I came across this (line 1018)
String fileURL = sresult.getSystemId();
if (fileURL.startsWith("file:///"))
{
fileURL = fileURL.substring(8);
}
m_outputStream = new java.io.FileOutputStream(fileURL);
I don't have a Unix box right here to test for the behavior but I believe
there should be a slight problem if we strip the / like this that we kindly
omitted in the JAXP code since we are making this a relative url...no more
an absolute one...bug 2731 and 2394 seems to confirm this.
Now if I'm looking at Redirect, I have a method urltofileName that has:
if(base.startsWith("file:////"))
{
base = base.substring(7);
}
else if(base.startsWith("file:///"))
{
base = base.substring(6);
}
else if(base.startsWith("file://"))
{
base = base.substring(5); // absolute?
}
else if(base.startsWith("file:/"))
{
base = base.substring(5);
}
else if(base.startsWith("file:"))
{
base = base.substring(4);
}
Okay..quite a lot of possibilities kindly handled here...
Now the final question: what is the systemid syntax for files ? :-)
Cheers,
Stephane