Let's say I have the following structure: <?xml version="1.0" encoding="UTF-8"?> <root> <child id="c1"> <child id="gc1"> <child id="ggc1"/> <child id="ggc2"/> </child> <child id="gc2"> <child id="ggc3"/> <child id="ggc4"/> </child> </child> <child id="c2"> <child id="gc3"> <child id="ggc5"/> <child id="ggc6"/> </child> <child id="gc4"> <child id="ggc7"/> <child id="ggc8"/> </child> </child> </root> By using the following XPath query //child[@id="gc3"]/child I can get the child nodes of "gc1". But what I'd really like to get is the sub branch/path going back to the root. So instead of just returning the two nodes <child id="ggc5"/> <child id="ggc6"/> I'd like to be able to return the sub branch/path <root> <child id="c2"> <child id="gc3"> <child id="ggc5"/> <child id="ggc6"/> </child> </child> </root> Is that possible? Or is this something I'd have to do programatically using the nodes returned by the XPath query? Basically, I'm just trying to get a fragment of the larger xml document... thnx, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php