I've got the following graph:
<?xml version="1.0" encoding="utf-8"?><graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<graph edgedefault="undirected">
<node id="a">
<data key="d0">some info</data>
</node>
<node id="b"/>
<node id="c">
<data key="d0">some more info</data>
</node>
<node id="d"/>
<edge source="a" target="b"/>
<edge source="a" target="c"/>
<edge source="b" target="c"/>
<edge source="b" target="d"/>
<edge source="c" target="d"/>
</graph>
</graphml>
And I'm trying to use XSLT to create a subset of the graph containing all nodes neighboring node a
.
Desired output:
<?xml version="1.0" encoding="utf-8"?><graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<graph edgedefault="undirected">
<node id="b"/>
<node id="c">
<data key="d0">some more info</data>
</node>
<edge source="b" target="c"/>
</graph>
</graphml>
I'm not a real expert of XSLT, but is it possible to do so in steps? i.e. first removing problematic edges, then removing neighborless nodes?