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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:41:29+00:00 2026-05-30T16:41:29+00:00

How to transform XML for one XSD into another XML format that is very

  • 0

How to transform XML for one XSD into another XML format that is very similar but has a different XSD file? The XSD is quite large and has many complex types, but the actual XML looks very similar.

I have two XSD files and two XML files – they both validate successfuly to one of the XSD files.
I would like to transform one of the XML files into the other so that I can use only one class for further operations.

How do I do this in .NET 4.0 and c# 4.0 ? Do I have to use XSLT or something? If I do have to use XSLT, how do I do this? I’m not sure I’m looking forward to creating an XSLT document.

It was kind of a nightmare using AutoMapper to convert one XML class into the other. When I looked at the XML it was so similar so I thought there may be an easier way…

  • 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-30T16:41:31+00:00Added an answer on May 30, 2026 at 4:41 pm

    I would definitely use XSLT. If the XML is very similar, it shouldn’t be too difficult. Start with an identity transform and then override it when something needs to change.

    The following example only changes “foo” elements to “bar” elements.:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output indent="yes"/>
      <xsl:strip-space elements="*"/>
    
      <!--Identity Template. This will copy everything as-is.-->
      <xsl:template match="@*|node()">
        <xsl:copy>
          <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
      </xsl:template>
    
      <!--Change "foo" element to "bar" element.-->
      <xsl:template match="foo">
        <bar>
          <xsl:apply-templates select="@*|node()"/>
        </bar>
      </xsl:template>
    
    </xsl:stylesheet>
    

    Resources:

    http://www.w3.org/TR/xslt

    http://www.jenitennison.com/xslt/

    http://www.mulberrytech.com/quickref/XSLT_1quickref-v2.pdf

    http://www.mulberrytech.com/xsl/xsl-list/index.html#archive

    Also, a huge part of XSLT is XPath. If you don’t have a development tool (my favorite is oXygen, @DimitreNovatchev has a great tool called the XPath Visualizer.

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

Sidebar

Related Questions

i want to transform some xml into HTML that has the following format: <TR><TD>
I'm using an XSL to transform one XML into another. My problem is that
I'm trying to transform one XML format to another using XSL. Try as I
I´m researching how to transform XML from one format to another in a Java
I want to write an xslt to transform one xml file to another. The
I need to transform one XML document into another using XSLT (for now from
I am using an XSL when clause to transform one XML file to another
I am looking for some help with XSLT to transform one xml file into
I have an XML file that I want to transform using an XSLT. It
I use XSL to transform a XML document into HTML in .NET. One of

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.