Project

Profile

Help

Bug #5749

closed

resolve-uri issue base-uri with a fragment

Added by Daniel Naab over 1 year ago. Updated over 1 year ago.

Status:
Won't fix
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2022-11-29
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

SaxonJS 2.5 introduced a bug with resolve-uri() and base-uri(), when the base-uri includes a fragment.

A reproduction of this issue is deployed here:

https://blog.crushingpennies.com/saxon-js-fragment-bug/

With the corresponding source code here: https://github.com/danielnaab/saxon-js-fragment-bug

You will note that SaxonJS.transform() is invoked with a sourceNode rather than specified by URL. As a result, base-uri falls back to the browser's current URL. Secondly, when that URL includes a fragment, errors of this form are returned:

http://localhost:3000/saxon-js-2.5#fragment contains a fragment identifier; code:FORG0002

Also note that the reproduction confirms that this behavior did not exist in SaxonJS 2.4.

Actions #1

Updated by Norm Tovey-Walsh over 1 year ago

Thanks. I have this recollection that I recently noticed and fixed this, but I can't immediately locate the corresponding bug. I'll investigate when I get a chance.

Actions #2

Updated by Norm Tovey-Walsh over 1 year ago

  • Status changed from New to Won't fix

Believe it or not, this isn't a bug (in SaxonJS):

The XPath Functions and Operators spec says of resolve-uri():

A dynamic error is raised [err:FORG0002] if $base is not a valid IRI according to the rules of RFC3987, extended with an implementation-defined subset of the extensions permitted in LEIRI, or if it is not a suitable IRI to use as input to the chosen resolution algorithm (for example, if it is a relative IRI reference, if it is a non-hierarchic URI, or if it contains a fragment identifier).

Looking at the code, the fact that it doesn't raise an error in SaxonJS 2.4 is actually the error.

Well, except that this is completely weird. See https://github.com/qt4cg/qtspecs/issues/280

I'm afraid the short-term answer is, strip off the fragment identifier before you call resolve-uri(). :-(

(Assuming the XSLT 4.0 CG is persuaded that this is a completely bogus restriction, and it gets fixed there, it will eventually get fixed in SaxonJS, but for the time being, this is a matter of conformance and we do strive to be conformant.)

Actions #3

Updated by Daniel Naab over 1 year ago

Ah okay - thank you for the clarification!

Please register to edit this issue

Also available in: Atom PDF Tracking page