If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

$Output="";
foreach ($names as $node) {
$Output.=$doc->saveXML($node->parentNode)."\n"; // We get the parent of "<firstname>" element (the entire "<person>" node and its children) (maybe get the parent node directly using xpath)
// and use the saveXML() to convert it to string
}

If i want to apply xsl, should i save the $output variabe in a file first and then apply xsl tranformation.. if i save it in a file..? i think i should save $output since that is xml rather the html one??

$Output="";
foreach ($names as $node) {
//$Output.=$doc->saveXML($node->parentNode)."\n"; // We get the parent of "<firstname>" element (the entire "<person>" node and its children)
$Output.=$doc->saveXML($node)."\n"; // and use the saveXML() to convert it to string
}