Skip to content

Apply namespace deduplication to xsl:namespace-alias branches#167

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/sub-pr-166
Closed

Apply namespace deduplication to xsl:namespace-alias branches#167
Copilot wants to merge 2 commits intomainfrom
copilot/sub-pr-166

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

The namespace deduplication logic (using isNamespaceDeclaredOnAncestor) was only applied to the non-alias branch, causing nested literal result elements with xsl:namespace-alias to repeat namespace declarations on every element.

Changes

  • Applied isNamespaceDeclaredOnAncestor check to both aliasPrefix === '#default' and prefixed alias branches
  • Ensures consistent deduplication behavior across alias and non-alias namespace handling
// Before: unconditional xmlns attribute
if (aliasPrefix === '#default') {
    if (namespaceUri) {
        domSetAttribute(newNode, 'xmlns', namespaceUri);
    }
}

// After: deduplicated against ancestors
if (aliasPrefix === '#default') {
    if (namespaceUri && !this.isNamespaceDeclaredOnAncestor(output, 'xmlns', namespaceUri)) {
        domSetAttribute(newNode, 'xmlns', namespaceUri);
    }
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Base automatically changed from issue-165 to main February 10, 2026 23:50
Copilot AI changed the title [WIP] Fix handling of xmlns and xmlns:* in HTML output mode Apply namespace deduplication to xsl:namespace-alias branches Feb 10, 2026
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.

2 participants