Here is two solutions to extract an XML element from set of files (which are TBS sub-templates).
1)
TBS has a documented method that enables you to get the source code of a TBS block, with or without the TBS fields that define the block.
You can use this method if you already have a TBS block for that part, or if it is possible for you to create a dedicated block in your sub-template.
2)
Otherwise, you can use an undocumented class clsTbsXmlLoc
provided with OpenTBS:
foreach ($templates as $template) {
$contents = file_get_contents($template);
$x = clsTbsXmlLoc::FindElement($contents, 'mc:AlternateContent', 0);
if ($x) {
$src = $x->GetSrc();
// use $x->GetInnerSrc() in order to get the content of <mc:AlternateContent>
// but wihtout the <mc:AlternateContent> tags.
file_put_contents('simple/'.$template);
} else {
echo "Element no found in sub-template $template";
}
}