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 6067937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:39:43+00:00 2026-05-23T09:39:43+00:00

I was adding a namespace in an element using xsl element namespace attribute. That

  • 0

I was adding a namespace in an element using xsl element namespace attribute. That adds empty namespace in child element in result.

Here is the XSL that adds namespace into element “Auto”

EDIT – short version of my xsl

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="no"/>
<xsl:template match="/">
    <xsl:element name="Root">
        <xsl:element name="Auto" namespace="http://www.Root.com/XMLSchema/Auto">
            <xsl:element name="Applicant">
                <xsl:element name="ApplicantType">
                    <xsl:text>Applicant</xsl:text>
                </xsl:element>
            </xsl:element>
        </xsl:element>
        <xsl:element name="Life" namespace="http://www.Root.com/XMLSchema/Auto">
            <xsl:element name="Applicant">
                <xsl:element name="ApplicantType">
                    <xsl:text>Applicant</xsl:text>
                </xsl:element>
            </xsl:element>
        </xsl:element>
    </xsl:element>
</xsl:template>

Here is the xml that transformed by XSL

<Root>
<Auto xmlns="http://www.Root.com/XMLSchema/Auto">
    <Applicant xmlns="">
        <ApplicantType>Applicant</ApplicantType>
    </Applicant>
</Auto>
</Root>

If you see the Applicant element, transformation added xmlns=””. How to remove this empty namespace?

  • 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-05-23T09:39:44+00:00Added an answer on May 23, 2026 at 9:39 am

    We can help you better if you show the XSL that’s producing the Applicant and ApplicantType elements. Also, you’re confusing “namespace” and “namespace declaration” in your description of the problem… separating these two might help you grasp the solution

    Your XSL code is apparently telling the processor to output the Applicant element in no namespace. (And therefore your code is probably wrong… you want Applicant to be in the same Auto namespace as its parent.) Since Applicant with no prefix would inherit the default namespace declaration from its parent, the output XML must “undeclare” the default namespace declaration, in order to put Applicant in no namespace as you requested.

    For example, if your XSL code says:

    <xsl:element name="Auto" namespace="http://www.Root.com/XMLSchema/Auto">
       <xsl:element name="Applicant">
    

    then you are telling XSL to output the Applicant element in no namespace, as described above. To fix this, you can repeat the namespace:

    <xsl:element name="Auto" namespace="http://www.Root.com/XMLSchema/Auto">
       <xsl:element name="Applicant" namespace="http://www.Root.com/XMLSchema/Auto">
    

    or as @empo said, you can declare a namespace prefix and use it:

    <xsl:stylesheet ... xmlns:auto="http://www.Root.com/XMLSchema/Auto">
       ...
          <auto:Auto>
             <auto:Applicant>
                <auto:ApplicantType>
       ...
    

    or use a default namespace declaration in the stylesheet (or template):

    <xsl:stylesheet ... xmlns="http://www.Root.com/XMLSchema/Auto">
       ...
          <xsl:element name="Auto">
             <xsl:element name="Applicant">
       ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am adding elements to an XML file during installation using the XmlFile element:
Adding an element to the head of an alist (Associative list) is simple enough:
When adding a DLL as a reference to an ASP.Net project, VS2008 adds several
I have the following XSL translator that is is being used to generate some
I have the following in my XSL which adds a xmlns to my XML.
I have a project that adds elements to an AutoCad drawing. I noticed that
I am using MSXML 6.0 to perform a transform of my own XML into
So here is a method I'm using to create form objects: protected function _getForm($form,
So I have a xml doc that I've declared here: DocumentBuilder dBuilder = dbFactory_.newDocumentBuilder();
Adding source files more than one directory away (e.g. ../../source.cpp or ../../../somewhere_else/source.cpp, vs. just

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.