Project

Profile

Help

Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version

Added by Kishlay Kumar almost 7 years ago

Hi Everyone!!!

I have been using Saxonica HE for XSLT transformation for quite a while and have been into trouble for a couple of days. Looking into the Help Discussions and forums for the solution to my problems, i could not find any proper resolution and so am posting my problems here. Hope the issues get answered.:)

I have been using the saxon9HE-api|Version: 9.5.1.8. My XSLT file has floor() function in it, and I see it is not giving the exact result. An example can be: floor(-2.3) returns -2 instead of -3.

Assumed it might have got fixed in the later release of Saxonica, so I have upgraded to the latest version i.e. saxon HE-api|Version: 9.8.1.0.

While the floor() returns the right values now, I got into a new problem. This new version complains when I have white spaces in my XSLT file path. It says "Invalid URI for stylesheet: <xslt_filename>".

I read in the Saxonica blogs/dev forums that it was already reported and fixed but I still see the issue in the most recent version, hence the worry!!

Also, I was wondering if there is any guide available that explains how to build the Saxon-HE source code that is available on SourceForge. I have the code downloaded onto my machine but need help in building it myself to see if I can fix/contribute to this bug.

I haven't worked with Java before, so detailed steps to build including the list of pre-requisites I should have on my machine to be able to build will be very useful.

Thanks very much in advance for your time and patience. :)


Replies (12)

Please register to reply

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by Michael Kay almost 7 years ago

You raise several separate issues here; it might be better not to conflate them.

Firstly, I'm not able to reproduce the reported problem with the floor() function on 9.5, and I'm not aware of any bug in this area. But to investigate it we would need to know exactly what the circumstances are (e.g. is it in backwards compatibility mode), and if the problem has gone away in 9.8 then we wouldn't normally investigate it.

Secondly, the issue with whitespace in URIs. It would be useful to know what API you used to supply the XSLT file path. Technically a URI cannot contain a space (it should be escaped as %20), though a filename can contain spaces, and different interfaces (and implementations!) vary a lot as to how liberal they are in permitting URI-like strings that are technically not valid URIs. We would like to know the detail here so that we can decide whether it is actually a bug (or something where we can improve the behaviour without violating any third-party spec).

Finally, how to build Saxon-HE. We fairly intentionally don't try to provide beginner-level instructions for this because we don't think it's a job beginners should attempt. Building the Java product isn't too difficult; building for .NET is a lot more complicated. There are two possible approaches: you can use the source code and build files found in the open source repository at dev.saxonica.com, or you can build from the source.zip files found on SourceForge.

If you use an IDE like IntelliJ, just dropping the source.zip from SourceForge into a source folder registered with the IDE is probably simplest: you may need to add a few open-source libraries to your classpath, but it shouldn't be difficult.

If you want to work from the Ant build files in the repository you will probably want to select a build target that ignores all the product variants you don't want to build, to reduce your dependencies. The source code in the repository needs to be preprocessed to extract different variants for HE/PE/EE, and you will also want to suppress the build phases that are concerned with signing the final JAR files.

If you're building with any intention of using your private build for production work, you will want to run a fairly comprehensive test. There are Ant build scripts for doing this, but you will want to check out the XSLT 3.0 and XQuery 3.1 test suites from W3C which the test scripts refer to.

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by Kishlay Kumar almost 7 years ago

Hi Michael,

Many thanks for your quick response :)

I have attached a simple .net console project here for your reference.

This project is currently referring to “saxon9he-api.dll” of 9.5.1.8 version. When you run the application, it reads the sample XML file(Input XML.xml) and XSLT file(XSLT file.xslt), I have already included in the project and tries the transformation. This transformation generates a HTML output. This is to capture the errors during transformation. My XSLT file has floor() function in it, and you can see there is an error entry in the HTML file at the end of the transformation because the floor() function evaluation is wrong in this version. This is my first problem.

Now, if you change the project reference to “9.8_saxon9he-api.dll” which is of 9.8.0.7 version and try the same, I cannot even complete the transformation because xsltCompiler.Compile(xsltInput) function, throws an exception “Invalid URI for stylesheet: ”. But if you place the XSLT file I have supplied in a path with no white-spaces, this succeeds, and no floor() problems too.

If you could help resolve one of the above issues, it will be very helpful. I will wait to hear from you and if I am lucky, I won’t need to even think about building the source code for this. :)

Please refer to !Project folder structure.PNG! attached for more information.

Thank again for your time and help. :)

Cheers!!!

Project folder structure.png (63.2 KB) Project folder structure.png Please try changing saxonica reference to the 9.8 version, where floor() is resolved but, issue is with the white spaces in the XSLT File path.
SaxonicaXSLTTransformer.zip (25.7 MB) SaxonicaXSLTTransformer.zip A sample Console application- Tried to replicate my issues for your reference.

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by Kishlay Kumar almost 7 years ago

Just realized the image was not uploaded properly... So trying here. !ProjectFolderStructure.png!

Thanks!!

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by Kishlay Kumar almost 7 years ago

Hi Michael,

Please could you look at the details I have given to reproduce the floor() issue in 9.5 HE version and "Invalid URI" issue in 9.8 HE version?

I have supplied the code I am using along with sample XML and XSLT files for your reference.

Your help and guidance on this is highly appreciated.

Cheers!!

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by Michael Kay almost 7 years ago

Thanks. We're all taking off to XML Prague tomorrow (without a Windows machine!) so we'll look at this next week.

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by Kishlay Kumar almost 7 years ago

Thanks, Michael, will look forward to hearing from you. Sorry for all the chasing.

Cheers!

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by Kishlay Kumar almost 7 years ago

Hi Micheal

Hope the XML Prague conference went well. Great to know that the SAXONICA is one of the sponsors.

Just wanted to send a kind reminder to look at the examples I have sent and provide your help on the matter.

Cheers!!

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by O'Neil Delpratt almost 7 years ago

Hi,

I have investigated this issue and managed to reproduce the problem reported. Please see the bug issue to track our progress in resolving the bug:

https://saxonica.plan.io/issues/3671

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by Kishlay Kumar almost 7 years ago

Hi O'Neil Delpratt

Thanks for your response, happy that it is logged as a bug and being worked on. Just so I know, would it be possible for you to give a rough estimated completion time?

Also, from the bug details, I understand this issue is being fixed in the latest version (v9.8), but we currently have another issue with this version to do with white spaces in the XSLT path. This was reported too in the above communication. Are you considering to fix that as well? Or we would like this to be fixed in 9.5 and get an update of that version maybe as a patch.

Please let us know.

Thanks!!

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by O'Neil Delpratt almost 7 years ago

I am investigating the whitespace issue. It looks like a bug in Saxon 9.8 which I am working on a patch.

As a workaround you can escape the white spaces in the file name which should work.

Alternatively to get your program working I did the following:

xsltInput = processor.NewDocumentBuilder().Build(new Uri("file:///" + xsltPath)) // the xsltPath string must have escaped white space i.e. %20

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by Kishlay Kumar almost 7 years ago

Hi O'Neil Delpratt

Many thanks for the workaround. Tried in my environment and it worked like a charm.

You said you are working to fix this though! Do you have a bug number that I can track to see its progress and get the patch when fixed?

Great if you could give a rough estimate when the patch can be available.

Thanks again!!

RE: Issue with floor() evaluation and white-spaces in XSLT file path - Saxonica HE version - Added by O'Neil Delpratt almost 7 years ago

Hi Kishlay,

You can track the white-space bug issue here: https://saxonica.plan.io/issues/3675

We normally don't schedule release dates as we normally ship when we have accumulated a number of bugs. We recently shipped a maintenance release for 9.8 last week, so based on the pattern of release dates I would anticipate the next maintenance release in 1-2 months.

I hope that helps.

    (1-12/12)

    Please register to reply