I\'m having a hard time wrapping my head around XSLT but I heard it\'s possible to split an XML file into multiple files. Basically I\'d like to copy all the elements up to
Responding to your comment on @Dimitre's answer...
You wrote,
This doesn't quite match your XML, which has rootelem as an outermost element, and your comment says root as an outermost element. You probably want something like this:
You could get fancier, trying to use instead of literal result elements for root and elem, but it doesn't seem worth the effort unless they're going to vary.