[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Saxon and FileURLConnection

Subject: Re: Saxon and FileURLConnection
From: David Tolpin <dvd@xxxxxxxxxxxxxx>
Date: Mon, 8 Dec 2003 14:35:23 +0400 (AMT)
fileurlconnection
> > This sounds like the right thing to do. By default saxon 
> > command line arguments are specified as being file names 
> > rather than URIs (so should use \ (although / also works, as 
> > is normally the case with command line tools on windows) but 
> > then that file name must be converted to a uri which means 
> > more or less changing \ to / and sticking file:// at the front.
> > 
> 
> But this code in Saxon is not invoked when executing the document()
> function!

Michael,

you are right, createURL is not used for  xsl:import and xsl:include
(that is, where backslashes are handled differently under Unix and Windows). I
thought the code was the same for the command line and import arguments and
was wrong.

I am sorry.

The cause of the problem (xsl:import href="data2\ss2.xsl" -- what's the base
URL for ss2.xsl?) is in sun.net.www.protocol.file.Handler, which is the implementation
of java.net.URLStreamHandler for file: protocol. It contains (jdk 1.3.1, previous releases
mentioned are  before 1.2.2, I think):

:    protected void parseURL(URL u, String spec, int start, int limit) {
:        /*
:         * Ugly backwards compatibility. Flip any file separator
:         * characters to be forward slashes. This is a nop on Unix
:         * and "fixes" win32 file paths. According to RFC 2396,
:         * only forward slashes may be used to represent hierarchy
:         * separation in a URL but previous releases unfortunately
:         * performed this "fixup" behavior in the file URL parsing code
:         * rather than forcing this to be fixed in the caller of the URL
:         * class where it belongs. Since backslash is an "unwise"
:         * character that would normally be encoded if literally intended
:         * as a non-seperator character the damage of veering away from the
:         * specification is presumably limited.
:         */
:        super.parseURL(u, spec.replace(File.separatorChar, '/'), start, limit);
:    }

that is, changes every '\' to '/' on win32 platforms. This is done intentionally,
causes bugs in stylesheets developed on Windows and run either on Unix or remotely, 
and easy to fix by installing a custom implementation of 'file' protocol handler, 
at least, for most java current java installations (>=1.3.1).

My impression is the damage of veering away from the specificitaion is serious in the
case of XSLT and handling of xsl:import, xsl:include, and document(). A stylesheet
that handles data.xml in each level of a deep hierarchy on a local disk, but only
processes the top-level data.xml when run on a Unix server or remotely via http
is a potential danger.

Does SAXON 7 exhibit the same behavior?

David


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.