Re: [xslt] Splitting a result into subtrees




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

$xpath = new DOMXpath($doc);
$node = $xpath->query("xpath_for_subtree_1")->item(0);
$subtree = new DOMDocument();
$subtree->appendChild($node->clone(TRUE));
$part1 = $subtree->saveXML();

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

Nick


Michael Ludwig wrote:
Nick Wellnhofer schrieb:

[...] Perl API [...]

my $part1 =
$doc->findnodes('xpath_for_subtree_1')->get_node(1)->toString();
my $part2 =
$doc->findnodes('xpath_for_subtree_2')->get_node(1)->toString();
...

The PHP API should provide similar functions.

Unfortunately, it doesn't. I guess I'd have
to use DOMDocument::getElementsByTagName or
DOMDocument::getElementsByTagNameNS.

http://de.php.net/manual/en/book.dom.php

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

--
aevum gmbh
rumfordstr. 4
80469 münchen
germany

tel: +49 89 3838 0653
http://aevum.de/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]