XML TO XML WITH XSLT

I have been receiving one file like this

<?xml version="1.0" encoding="utf-8"?>
<StudentDocument xmlns:sdtc="urn:sl7-org:sdtc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hvhs="urn:hvhs:student-extensions" xmlns="urn:student-org:v3">
  <recordTarget>
    <StudentRole>
      <id root="22" extension="65478" />
    <id root="23" extension="777-22-333" />
    <id root="24" extension="33333333" />
        <addr use="RT">
        <streetAddressLine>Address1</streetAddressLine>
        <city>City</city>
        <state>ST</state>
        <postalCode>55555</postalCode>
        <country>XT</country>
      </addr>
        <telecom use="TE" value="tel:+17248468200" />
      <Student>
        <name>
          <family>john</family>
              <given>katey</given>
        </name>
      </Student>
      </StudentRoleRole>
</recordTarget>
</StudentDocument>

I want to generate formatted XML like the below by using XSLT. How do i write it in visual studio 2013?

<StudentResultData>
      <ROLLNUMBER>777-22-333</ROLLNUMBER>
      <Phone>7248468200</Phone>
      <firstname>John</firstname>
      <lastname>katey</lastname>
      <address1>Address1</address1>
      <city>City<city>
      <zip>55555</zip>
      <state>ST</state>
      <country>XT</country>
</StudentResultData>
mynetquestionsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zc2Commented:
Supposedly you have the XML stored in a file, then go to File menu->New->File, Choose "XSLT File".
Create your XSLT script in the new opened window.
To test the XSLT transformation, go to the XML manu, choose "Start XSLT debugging" or press Alt+F5
mynetquestionsAuthor Commented:
I know how to open XSLT file in visual studio 2013. I am looking for XSLT code to generate from the given to required XML format
zc2Commented:
Here is the XSLT sample:

<?xml version="1.0" encoding="utf-8"?>
<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 s"
    xmlns:s="urn:student-org:v3">
    <xsl:output method="xml" indent="yes"/>

    <xsl:template match="s:StudentDocument">
        <StudentResultData>
            <xsl:apply-templates select="s:recordTarget/s:StudentRole"/>
        </StudentResultData>
    </xsl:template>

    <xsl:template match="s:StudentRole">
          <ROLLNUMBER><xsl:value-of select="s:id[@root=23]/@extension"/></ROLLNUMBER>
          <Phone><xsl:value-of select="substring-after(s:telecom[@use='TE']/@value,'+1')"/></Phone>
          <firstname><xsl:value-of select="s:Student/s:name/s:family"/></firstname>
          <lastname><xsl:value-of select="s:Student/s:name/s:given"/></lastname>
          <address1><xsl:value-of select="s:addr/s:streetAddressLine"/></address1>
          <city><xsl:value-of select="s:addr/s:city"/></city>
          <zip><xsl:value-of select="s:addr/s:postalCode"/></zip>
          <state><xsl:value-of select="s:addr/s:state"/></state>
          <country><xsl:value-of select="s:addr/s:country"/></country>
    </xsl:template>
</xsl:stylesheet>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mynetquestionsAuthor Commented:
It was really helpful and written my own XSLT files for other XML files based on this solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.