Beginner - Need help with a simple XML to XML by XSLT

Sorry, I'm a true beginner and I plan to take some classes, But I have this quick question.  This is a small sample of the code.

     <MissionInfo Name="YtYtYtYt">
Needed Result:
     <MissionInfo Name="YtYtYtYt">

My code:
      <MissionInfo><xsl:value-of select="MissionInfo/@Name"/>

My result:
Who is Participating?
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.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
The <xsl:value-of .../> just puts the content directly into the output XML in whatever context you are currently in. Hence why you are getting what you have, the <xsl:value-of> is inside the MissionInfo element and so the content just goes inside that element in the output.

You will need to use the <xsl:attribute ...> element to identify an attribute (eg. Name) that you are trying to set and then you can use the <xsl:value-of .../> inside that to set that attribute to whatever you want.

So for this you would do...
   <xsl:attribute name="Name">
      <xsl:value-of select="MissionInfo/@Name"/>

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
Nancy_McIverAuthor Commented:
Thanks so much!  I knew if I could ask a question I could find out quicker with you guys then spending hours figuring it out. Yes, I know, time to take a class. . .but I'm loving it this new adventure!
mccarlIT Business Systems Analyst / Software DeveloperCommented:
You welcome! :)
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

From novice to tech pro — start learning today.