Updating XPath for a corner case with NCName.#164
Conversation
Coverage report
Test suite run success570 tests passing in 60 suites. Report generated by 🧪jest coverage report action from 0794845 |
There was a problem hiding this comment.
Pull request overview
Adds a regression test to ensure XPath/XSLT variable names that coincide with XPath function names (NCName corner case) are parsed/evaluated correctly, alongside updating the vendored src/xpath/lib submodule.
Changes:
- Added an XSLT test case covering variables named like XPath functions (e.g.,
name). - Updated the
src/xpath/libsubproject commit to include the XPath fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/xslt/xslt.test.tsx | Adds a regression test for variable-name parsing when the name matches an XPath function name. |
| src/xpath/lib | Bumps the XPath submodule to the commit that presumably fixes the NCName corner case. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <xsl:template match="/"> | ||
| <out> | ||
| <xsl:variable name="name">a</xsl:variable> | ||
| <xsl:if test="$name = 'a'">A</xsl:if> | ||
| </out> | ||
| </xsl:template> |
There was a problem hiding this comment.
This test is brittle because the indentation/newlines inside the literal result element <out>...</out> can be serialized as whitespace text nodes depending on the XSLT processor/serializer configuration. To make the assertion stable, either (a) remove formatting whitespace from the template body (e.g., put the instructions adjacent with no whitespace between them), or (b) explicitly control serialization (e.g., add <xsl:output omit-xml-declaration=\"yes\"/> and/or use <xsl:text> so the expected output is deterministic).
| <xsl:template match="/"> | |
| <out> | |
| <xsl:variable name="name">a</xsl:variable> | |
| <xsl:if test="$name = 'a'">A</xsl:if> | |
| </out> | |
| </xsl:template> | |
| <xsl:template match="/"><out><xsl:variable name="name">a</xsl:variable><xsl:if test="$name = 'a'"><xsl:text>A</xsl:text></xsl:if></out></xsl:template> |
Resolves #163