Skip to content

Fix relative xsl:import path resolution when stylesheet load#206

Open
Laurettta wants to merge 1 commit intodevelop-7.x.xfrom
7.x.x/hotfix/xslt-relative-import-href-not-resolved-in-db
Open

Fix relative xsl:import path resolution when stylesheet load#206
Laurettta wants to merge 1 commit intodevelop-7.x.xfrom
7.x.x/hotfix/xslt-relative-import-href-not-resolved-in-db

Conversation

@Laurettta
Copy link
Copy Markdown

When a stylesheet is loaded from the database via doc(), the base URI comes through as a plain path like /db/collection/a.xsl with no xmldb:exist:// scheme. The URI resolver treated it as non-absolute and just returned the relative href unchanged, so <xsl:import href="b.xsl"/> failed even when b.xsl was sitting in the same collection.

The fix checks if the base path starts with / and if so rebuilds it as a full xmldb:exist:// URI before resolving the import.

…ed from database

  Closes #169

  When a stylesheet is loaded from the database as a document node, its
  base URI is stored as a bare path (e.g. /db/collection/a.xsl) with no
  scheme. The URI resolver did not recognise this as a database path and
  returned the relative href unchanged, causing xsl:import with a relative
  path to fail. The fix detects the bare path, extracts the directory, and
  reconstructs the full xmldb:exist:// URI so the import resolves correctly.
@Laurettta Laurettta added the bug Something isn't working label May 6, 2026
@cla-bot cla-bot Bot added the cla-signed label May 6, 2026
@codacy-production
Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cla-signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant