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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:14:33+00:00 2026-05-30T04:14:33+00:00

I have a requirement to run a transform on a xml file. it is

  • 0

I have a requirement to run a transform on a xml file. it is going to be very basic, but having never done any xslt work before I’m a bit lost. i’ve had a very of a lot of SO Q&A’s but have not been able to work it out?

What I require is my xml file has a schema reference and I need to change it to a different schema reference.

<?xml version="1.0" encoding="UTF-8"?>
<Schedule xmlns="http://www.xxx.com/12022012/schedule/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xxx.com/12022012/schedule/v2 ../Schema/Schema_v2.xsd">
  <Interface_Header>
  </Interface_Header>
...
</Schedule>

I just want to alter the V2’s to V3’s, and keep the remainder of the file intact? It sounds very simple, but I cannot seem to figure this out? I tried a simple xslt here:-

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>

 <xsl:template match="node()|@*">
  <xsl:copy>
   <xsl:apply-templates select="node()|@*"/>
  </xsl:copy>
 </xsl:template>
</xsl:stylesheet>

but using this outputs all my values without any xml tags.

thanks in adv.

  • 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-30T04:14:34+00:00Added an answer on May 30, 2026 at 4:14 am

    Use:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xmlns:ns="new_namespace">
        <xsl:output method="xml" indent="yes"/>
    
        <xsl:template match="@xsi:schemaLocation">
            <xsl:attribute name="xsi:schemaLocation">
                <xsl:text>new_schema_location</xsl:text>
            </xsl:attribute>
        </xsl:template>
    
        <xsl:template match="node() | @*">
            <xsl:copy>
                <xsl:apply-templates select="node() | @*"/>
            </xsl:copy>
        </xsl:template>
    
        <xsl:template match="*">
            <xsl:element name="{local-name()}" namespace="ns">
                <xsl:apply-templates select="node() | @*"/>
            </xsl:element>
        </xsl:template>
    
    </xsl:stylesheet>
    

    applied to provided XML produces

    <Schedule xsi:schemaLocation="new_schema_location" xmlns="ns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <Interface_Header>
        </Interface_Header>
        ...
    </Schedule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have requirement of specifying web part connections in onet.xml. So when site is
I've got a requirement to take some XML and transform it into a fixed-width
I have a requirement to run a query against a database that will return
I have requirement like this: On one server(linux) I need to run 2 instances
I have a requirement where an application which is run by windows service to
so I have this requirement to kick off Activities provided to me at run-time.
I have a requirement to run a server script on scheduled times entered by
I have a requirement to run a java jar on a low privilege user
I have a requirement to run commands in the following order to automate the
I have a requirement that I need to run the tests through commandline as

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.