Skip to content

Fixing issues reported at #160 and #161.#162

Merged
leonelsanchesdasilva merged 2 commits intomainfrom
issues_160_161
Feb 4, 2026
Merged

Fixing issues reported at #160 and #161.#162
leonelsanchesdasilva merged 2 commits intomainfrom
issues_160_161

Conversation

@leonelsanchesdasilva
Copy link
Collaborator

  • Issue 160 Loop: Verifies that <xsl:element> inside a loop renders unique content for each item.
  • Issue 161 Order: Verifies that mixed <xsl:element> and literal tags appear in the correct interleaved order.

Resolves #160 and #161.

- Issue 160 Loop: Verifies that `<xsl:element>` inside a loop renders unique content for each item.
- Issue 161 Order: Verifies that mixed `<xsl:element>` and literal tags appear in the correct interleaved order.
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
76.86% (+0.01% 🔼)
3148/4096
🟡 Branches
66.69% (-0.01% 🔻)
1814/2720
🟡 Functions 70.73% 377/533
🟡 Lines
76.92% (+0.01% 🔼)
3010/3913
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢 xslt/xslt.ts
82.15% (+0.01% 🔼)
71.33% (-0.03% 🔻)
88.62%
82.19% (+0.01% 🔼)

Test suite run success

569 tests passing in 60 suites.

Report generated by 🧪jest coverage report action from 1c68ad1

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

This pull request fixes two related bugs with <xsl:element> behavior inside loops, as reported in issues #160 and #161. Issue #160 caused <xsl:element> inside <xsl:for-each> to repeat the first item's content for all iterations, while issue #161 caused incorrect ordering when mixing <xsl:element> with literal tags.

Changes:

  • Added test cases for both issues verifying correct context preservation and element ordering
  • Fixed context preservation in xsltElement by removing explicit position reset
  • Added siblingPosition tracking to preserve document order for dynamically generated elements

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/gh_issues_160_161.test.tsx New test file with two test cases validating that xsl:element works correctly inside loops and maintains proper ordering with literal tags
src/xslt/xslt.ts Fixed xsltElement to preserve context (line 1341) and set siblingPosition before appending (line 1336) to maintain document order

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@leonelsanchesdasilva leonelsanchesdasilva merged commit 7ef4be8 into main Feb 4, 2026
3 checks passed
@leonelsanchesdasilva leonelsanchesdasilva deleted the issues_160_161 branch February 4, 2026 17:06
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.

Wrong XML element used when using <xsl:element>

1 participant