Project

Profile

Help

Bug #3377

HTML base tag ignored in stylesheetLocation and sourceLocation

Added by Debbie Lockett 7 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Sprint/Milestone:
-
Start date:
2017-08-08
Due date:
% Done:

100%

Applies to JS Branch:
1.0, Trunk
Fix Committed on JS Branch:
1.0, Trunk
Fixed in JS Release:
SEF Generated with:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

The following bug was not present in Saxon-JS 1.0.0; but appears in Saxon-JS 1.0.1.

As reported by a user:

with the new version it appears to ignore the <base/> tag reference in the HTML page so I have to change all my previous code to use absolute paths e.g. I changed to start with ‘/’

stylesheetLocation: "/resources/scripts/root.sef.xml",

sourceLocation: "/resources/config/profile.xml"

Previously, I had used the html base tag to establish this context

<base href="/">

    <script type="text/javascript" src="resources/scripts/SaxonJS.min.js"></script>

    <script>

        function update(clock) {

            SaxonJS.transform({

                stylesheetLocation: "resources/scripts/root.sef.xml",

                sourceLocation: "resources/config/profile.xml" 

            });

        }

        function run() {

            update();

            window.setInterval(update,5000000000000);

        }

    </script>

Relative URIs supplied for stylesheetLocation or sourceLocation should be resolved against the URI of the HTML page. However Saxon-JS ignores any <base> tag used in an HTML page, so the base URI we resolve against is incorrect.

Rather than using window.location.toString() we should use window.document.baseURI

Note that previously (in Saxon 1.0.0) we did not resolve the URI ourselves, but rather passed a relative URI directly to the XMLHttpRequest.open() call - which handled the resolving correctly in this case.

History

#1 Updated by Debbie Lockett 7 months ago

  • Status changed from New to In Progress
  • Assignee set to Debbie Lockett

Bug reproduced. JS unit test sourceLocation02 added to test use of the HTML base tag.

#2 Updated by Debbie Lockett 7 months ago

  • Applies to JS Branch 1.0, Trunk added

#3 Updated by Debbie Lockett 6 months ago

  • Status changed from In Progress to Resolved
  • Fix Committed on JS Branch 1.0, Trunk added

Also made the same change (to use window.document.baseURI rather than window.location.toString()) for the URI stored in context.fixed.htmlURI

Bug fix committed on the 1.0 and trunk branches.

#4 Updated by Debbie Lockett 5 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to Saxon-JS 1.0.2

Bug fix applied in Saxon-JS 1.0.2 maintenance release.

Please register to edit this issue

Also available in: Atom PDF Tracking page