I have this xml structure:
<section id="Test1">
<pkg:transition id="Test">
<h>CADTeam<translation lang="en">CADTeam</translation></h>
<abstract>CADTeam<translation lang="en">CADTeam</translation></abstract>
<import name="man/dummy.txt" />
</pkg:transition>
<pkg:transition id="CommTeam">
<h>CommTeam<translation lang="en">CommTeam</translation></h>
<abstract>CommTeam<translation lang="en">CommTeam</translation></abstract>
<import name="man/dummy.txt" />
</pkg:transition>
<pkg:transition id="KeyUser">
<h>KeyUser<translation lang="en">KeyUser</translation></h>
<abstract>KeyUser<translation lang="en">KeyUser</translation></abstract>
<import name="man/dummy.txt" />
</pkg:transition>
<pkg:stelle id="Error">
<h>Error<translation lang="en">Error</translation></h>
<abstract>Error<translation lang="en">Error</translation></abstract>
<import name="man/dummy.txt" />
</pkg:stelle>
</section>
I have several sections but I want to copy a specific section. We can use this for example. I want to copy this whole section with all the elements and attributes and paste it to another block in the xml file. My question is how can I copy this hole section into a variable?
I tried this method but it didn't work:
var section = from sections in xdocument.Descendants("section")
where sections.Attribute("id").Value == selecteditem
select sections.Descendants();
Thank You.