Nick Wellnhofer schrieb:

I see, only the standard DOM functions are available. Then it's a bit
more complicated. Something like that:

Thanks a lot, Nick! I'm taking the liberty to present a working example:

$xml_str = "<Urmel><Eins/><Zwei/><Drei>Juhu</Drei></Urmel>";
$doc = new domdocument;
$doc->loadxml( $xml_str);
echo $doc->savexml();

$xpath = new domxpath( $doc);
$drei = $xpath->query( '/Urmel/Drei')->item(0);

$subtree = new domdocument;
$subtree->appendChild( $subtree->importNode( $drei, TRUE));
echo $subtree->savexml();

Can't believe I haven't discovered this before. I thought it was
missing, although it is documented.

But that's basic DOM manipulation and doesn't really belong on this
list.

True. Thanks nonetheless.

Michael Ludwig
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
http://mail.gnome.org/mailman/listinfo/xslt

Reply via email to