Project

Profile

Help

Invalid URI: The URI is empty

Added by Anonymous almost 18 years ago

Legacy ID: #3785892 Legacy Poster: Robert Brotherus (rbrother)

Greetings from a long-time saxon fan! In saxon.net 8.7.3n, following code fails to compile the given xslt file: Stream xsltStream = new FileStream(xsltFileName, FileMode.Open, FileAccess.Read); XmlReader reader = new XmlTextReader(xsltStream); compiler.BaseUri = new Uri("file:///c:/SourceCode/DMCM/bin/xslt/"); this.compiler.ErrorList = new ArrayList(); this.compiler.Compile(xsltReader); // FAILS The transform itself uses several includes that are meant to be loaded from the same dir: <xsl:transform version="2.0"> <xsl:include href="constants.xslt"/> ... If I make a simple transform that has no includes, the compilation goes ok. I am wondering if I am still doing something wrong or is the saxon engine behaving badly? Robert J. Brotherus


Replies (5)

Please register to reply

RE: Invalid URI: The URI is empty - Added by Anonymous almost 18 years ago

Legacy ID: #3786008 Legacy Poster: Michael Kay (mhkay)

Saxon will be looking for the includes in: file:///c:/SourceCode/DMCM/bin/xslt/constants.xslt Is that where they are?

RE: Invalid URI: The URI is empty - Added by Anonymous almost 18 years ago

Legacy ID: #3786372 Legacy Poster: Robert Brotherus (rbrother)

Yes, all my xslt-files (including constants.xslt) are located at folder c:\SourceCode\DMCM\bin\xslt. So for example, the file c:\SourceCode\DMCM\bin\xslt\constants.xslt does exist. Still I get the "Invalid URI: The URI is empty" error when compiling. The error occurs with exactly same message, if I replace "file:///c:/SourceCode/DMCM/bin/xslt/" with eg. one of the following: - @"c:\SourceCode\DMCM\bin\xslt" - "file:///c:/" - "http://www.yahoo.com/" When running the full transformation with Saxon.net command line tools, it proceeds with not errors (handles the includes ok). The problem seems to have some similarity with this one: https://sourceforge.net/forum/message.php?msg_id=3768422 Although in that case the xslt-compilation seemed to be ok and problems was with the base URI of the xml-document to be transformed. Thank you for your help!

RE: Invalid URI: The URI is empty - Added by Anonymous almost 18 years ago

Legacy ID: #3786540 Legacy Poster: Michael Kay (mhkay)

I've reproduced the problem, and will investigate it as soon as I can. Sorry about the inconvenience. In the meantime, I suggest that rather than supplying stylesheet input from a stream, you supply it from a URI.

RE: Invalid URI: The URI is empty - Added by Anonymous almost 18 years ago

Legacy ID: #3786924 Legacy Poster: Michael Kay (mhkay)

It turns out that in the version of the Compile() method that takes an XmlReader as argument, Saxon is using the BaseUri property of the XmlReader rather than the BaseUri property of the Compiler. You can set this at the time you construct the XmlReader, for example XmlReader reader = new XmlTextReader("file:///c:/MyDotNet/samples/trax/xsl/", xsltStream); I will change the code so that it uses the base URI of the Compiler if there is no base URI on the XmlReader (it's not obvious which should take priority, but I think that makes sense, so long as it's clearly documented). Thanks for your feedback. It's still early days for this API, so this kind of experience is very useful. Michael Kay Saxonica

RE: Invalid URI: The URI is empty - Added by Anonymous almost 18 years ago

Legacy ID: #3788571 Legacy Poster: Robert Brotherus (rbrother)

Thanks for the advice - circumventing the problem by supplying URI for stylesheet input worked fine and simplifies my code as well!

    (1-5/5)

    Please register to reply