Fix recursive xsl:call-template producing NaN via result-tree fragment variables - #218
Merged
Merged
Conversation
…t variables xsl:variable/xsl:param with element content builds a NodeSetValue wrapping a DocumentFragment (nodeType 11). Arithmetic expressions atomizing such a value fell through getStringValueFromNode() to null, coercing to NaN. This blocked recursive named-template patterns (factorial, power, etc.) that stash a nested call-template's result in a variable before using it in arithmetic. Bumps src/xpath/lib submodule to DesignLiquido/xpath@3dff86f, which fixes getStringValueFromNode() to treat document fragment nodes like elements. Resolves #217 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Coverage report
Test suite run success675 tests passing in 66 suites. Report generated by 🧪jest coverage report action from 89664d2 |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an XPath/XSLT interoperability bug where result-tree fragment variables (document fragments, nodeType === 11) could atomize to null and then coerce to NaN during arithmetic, breaking common recursive xsl:call-template patterns (e.g., factorial) that store a nested call result in an xsl:variable.
Changes:
- Adds a regression test covering recursive
xsl:call-templatewith an intermediate variable used in arithmetic (Issue #217). - (Per PR description) Bumps the
src/xpath/libsubmodule to include the upstream fix that treats document fragments as element-like for string-value extraction.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
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.
xsl:variable/xsl:paramwith element content builds aNodeSetValuewrapping aDocumentFragment(nodeType11). Arithmetic expressions atomizing such a value fell throughgetStringValueFromNode()tonull, coercing toNaN. This blocked recursive named-template patterns (factorial, power, etc.) that stash a nestedcall-template's result in a variable before using it in arithmetic.Bumps
src/xpath/libsubmodule to DesignLiquido/xpath@3dff86f, which fixesgetStringValueFromNode()to treat document fragment nodes like elements.Resolves #217