Skip to content

Updating XPath for a corner case with NCName.#164

Merged
leonelsanchesdasilva merged 1 commit intomainfrom
issue-163
Feb 10, 2026
Merged

Updating XPath for a corner case with NCName.#164
leonelsanchesdasilva merged 1 commit intomainfrom
issue-163

Conversation

@leonelsanchesdasilva
Copy link
Collaborator

Resolves #163

@github-actions
Copy link

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 76.86% 3148/4096
🟡 Branches 66.69% 1814/2720
🟡 Functions 70.73% 377/533
🟡 Lines 76.92% 3010/3913

Test suite run success

570 tests passing in 60 suites.

Report generated by 🧪jest coverage report action from 0794845

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/lib subproject 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.

Comment on lines +64 to +69
<xsl:template match="/">
<out>
<xsl:variable name="name">a</xsl:variable>
<xsl:if test="$name = 'a'">A</xsl:if>
</out>
</xsl:template>
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
<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>

Copilot uses AI. Check for mistakes.
@leonelsanchesdasilva leonelsanchesdasilva merged commit f95606d into main Feb 10, 2026
8 of 9 checks passed
@leonelsanchesdasilva leonelsanchesdasilva deleted the issue-163 branch February 10, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Variables using function names are mis-typed.

1 participant