Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing fn:transform global parameters #4883

Merged

Conversation

alanpaxton
Copy link
Collaborator

@alanpaxton alanpaxton commented Apr 25, 2023

Description:

Transformation fails to load global parameters from the stylesheet when it is loaded from eXist-db (rather than in memory).

Stylesheet document fetching into sources is not recognising as documents the documents it received from the DB (as opposed to ones which are constructed in memory). All our testing has been done with temporary in memory documents and we missed the case of a transformation source coming from the persistent db.

To fix this, we just have to recognise org.exist.dom.persistent.DocumentImpl as well as org.exist.dom.memtree.DocumentImpl as a valid document source; similarly, the case where a document can be a NodeProxy wasn’t recognised, we just need to fetch the node from the proxy when we recognise it as such, and proceed with using a source wrapping the resulting node as the stylesheet source.

Reference:

Closes #4609

Type of tests:

  • eXide files detailed in the bug report now produce the correct transformation, rather than an error
  • Added an XQSuite unit test transformation loading stylesheet from a resource: and input document from database added; confirmed this Unit Test failed before the changes and now passed.

Problem manifests when loading the stylesheet from eXist-db.

Stylesheet document fetching into sources is not recognising as documents the documents it received from the DB (as opposed to ones which are constructed in memory). All our testing has been done with temporary in memory documents and we missed the case of transform source in eXist-db.

To fix it, we just have to recognise org.exist.dom.persistent.DocumentImpl as well as org.exist.dom.memtree.DocumentImpl as a valid document source;
similarly, the case where a document can be a NodeProxy wasn’t recognised, we just need to fetch the node from the proxy when we recognise it as such, and proceed with using a source wrapping the resulting node as the stylesheet source.

This appears to make the
@adamretter adamretter self-requested a review April 27, 2023 17:50
@adamretter adamretter added bug issue confirmed as bug needs 6.x.x backport labels Apr 27, 2023
@adamretter adamretter added this to the eXist-7.0.0 milestone Apr 27, 2023
@adamretter adamretter changed the title [fix] fn:transform global parameters missing Fix missing fn:transform global parameters Apr 27, 2023
Copy link
Member

@adamretter adamretter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alanpaxton LGTM

@sonarcloud
Copy link

sonarcloud bot commented May 10, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

62.1% 62.1% Coverage
0.0% 0.0% Duplication

@adamretter adamretter merged commit 6314769 into eXist-db:develop May 10, 2023
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue confirmed as bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] fn:transform not evaluating global params correctly
3 participants