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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:52:20+00:00 2026-05-10T15:52:20+00:00

I have an XML document with un-namespaced elements, and I want to use XSLT

  • 0

I have an XML document with un-namespaced elements, and I want to use XSLT to add namespaces to them. Most elements will be in namespace A; a few will be in namespace B. How do I do this?

  • 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. 2026-05-10T15:52:20+00:00Added an answer on May 10, 2026 at 3:52 pm

    With foo.xml

    <foo x='1'>     <bar y='2'>         <baz z='3'/>     </bar>     <a-special-element n='8'/> </foo> 

    and foo.xsl

        <xsl:template match='*'>         <xsl:element name='{local-name()}' namespace='A' >             <xsl:copy-of select='attribute::*'/>             <xsl:apply-templates />         </xsl:element>     </xsl:template>      <xsl:template match='a-special-element'>         <B:a-special-element xmlns:B='B'>             <xsl:apply-templates match='children()'/>         </B:a-special-element>     </xsl:template>  </xsl:transform> 

    I get

    <foo xmlns='A' x='1'>     <bar y='2'>         <baz z='3'/>     </bar>     <B:a-special-element xmlns:B='B'/> </foo> 

    Is that what you’re looking for?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a document which uses an XML namespace for which I want to
I have an XML document in which I want to search for some elements
I have an xml document as a string without any namespace and I want
I often have to deal with XML documents that contain namespaced elements, but doesn't
Have a source xml document that uses namespace containing prefixes and a default namespace.
I have an XML document with a default namespace indicated at the root. Something
TASK : I have an existing xml document (UTF-8) which uses xml namespaces and
I have an XML document, and I want to print the tag names and
Suppose I have such elements in my XML document: <xs:appinfo> <CustomXML> <Something>something</Something> </CustomXML> </xs:appinfo>
I've got an XML document with many different namespaces in use and a schema

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.