-
Notifications
You must be signed in to change notification settings - Fork 34
Revamping Expression Context, special operator for XPath, etc. #65
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Disabling XPath cache for now.
- Adding context to XSLT tests.
Coverage report
Show files with reduced coverage 🔻
Test suite run success51 tests passing in 14 suites. Report generated by 🧪jest coverage report action from 12fd8e8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Special thanks to Marco Balestra on this one.
First of all, XPath became a big pain when using
<xsl:template>
with<xsl:apply-templates>
because:<xsl:apply-templates>
, since there's not a good way to select the current nesting level appropriately;To resolve the issues with
<xsl:apply-templates>
and relative paths, I created this special axis,self-and-siblings
. It seems to solve the problems very well so far, but nothing prevents me to remove it if I find a better approach using pure XPath.At versions 1.1.x, I was using the input to map the output nodes. It was very convenient, but it doesn't work well in occasions that one match needs to revisit a node that already generated the output. For this reason, I decided to expand the Expression Context to accommodate the input and the output, with input nodes holding a reference to its direct output node.
Some tests are skipped because they are incorrect, considering tests in other XSLT libraries. They should be revisited in the future.
Finally, the
<xslt:sort>
needs to be called explicitly, and it is not executed by default during<xslt:apply-templates>
as before. To solve the output positioning, I created a property calledsiblingPosition
, which it is copied to output nodes, preserving the order while writing the output XML.