Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7768511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:55:55+00:00 2026-06-01T15:55:55+00:00

I am using Microsoft’s XSLT processor (1.0 only) XML opening lines: <?xml version=1.0 encoding=utf-8?>

  • 0

I am using Microsoft’s XSLT processor (1.0 only)

XML opening lines:

<?xml version="1.0" encoding="utf-8"?>
<Header xmlns="http:\\OldNameSpace.com">
    <Detail>

Have the following XSLT template to pick up the <Header> element of my document and change its namespace.

<xsl:template match="*">
    <xsl:element name="{name()}" xmlns="http:\\NewNameSpace.com"> 
        <xsl:copy-of select="@*"/>
        <xsl:apply-templates />
    </xsl:element>
</xsl:template>

Which turns <Header xmlns="http:\\OldNameSpace.com"> Into <Header xmlns="http:\\NewNameSpace.com">

However I now need to add a second namespace to this so that I get the following output:

<Header xmlns="NewNameSpace.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

I have tried using:

<xsl:template match="*">
    <xsl:element name="{name()}" xmlns="NewNameSpace.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
        <xsl:copy-of select="@*"/>
        <xsl:apply-templates />
    </xsl:element>
</xsl:template>

However I still only get the same output as the original XSLT template.

Can anyone enlighten to me as to why this is?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:55:56+00:00Added an answer on June 1, 2026 at 3:55 pm

    This transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:old="http:\\OldNameSpace.com"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      exclude-result-prefixes="old xsi">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:param name="pNewNamespace" select="'http:\\NewNameSpace.com'"/>
    
     <xsl:variable name="vXsi" select="document('')/*/namespace::*[name()='xsi']"/>
    
     <xsl:template match="node()|@*">
         <xsl:copy>
           <xsl:apply-templates select="node()|@*"/>
         </xsl:copy>
     </xsl:template>
    
        <xsl:template match="old:*">
            <xsl:element name="{local-name()}" namespace="{$pNewNamespace}">
              <xsl:copy-of select="$vXsi"/>
                <xsl:copy-of select="@*"/>
                <xsl:apply-templates />
            </xsl:element>
        </xsl:template>
    </xsl:stylesheet>
    

    when applied on the following XML document:

    <Header xmlns="http:\\OldNameSpace.com">
        <Detail/>
    </Header>
    

    produces (what I guess is) the wanted, correct result:

    <Header xmlns="http:\\NewNameSpace.com"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <Detail/>
    </Header>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Microsoft.Reporting.Webforms version 10 in order to parse an RDLC file and produce
Using Microsoft SQL Server's database mirroring capability, can the mirroring occur between two clusters?
Using: Microsoft SQL Server 2008 Microsoft Visual Studio 2010 C# .NET 4.0 WinForms Ok
using Microsoft.SqlServer.Management.SqlStudio.Explorer; unable to find this pls assist [update] found the dll's in this
Using Microsoft Visual Studio 2010: Can I write this type of macro in C?
Using Microsoft SQL server 2008 I have a query that is in need of
When using Microsoft office automation I want to insert images into a spreadsheet. How
I am using Microsoft Access 2007 to move and massage some data between two
I'm using Microsoft.XMLHTTP to get some information from another server from an old ASP/VBScript
I am thinking about using Microsoft Unity for my Dependency Injection tool in our

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.