Im brand new to xslt conversions, and I need help with one kind of conversion. I need to group all the nodes of a certain type with one of its attributes and list the parents of all the attributes. This is a kind of generalization of the use of certain things in a document. I will give a simplified example.
Input:
<root> <node name="node1"> <somechild child-id="1"> </node> <node name="node2"> <somechild child-id="2"> </node> <node name="node3"> <somechild child-id="1"> </node> <node name="node4"> <somechild child-id="2"> </node> <node name="node5"> <somechild child-id="3"> </node> </root>
Desired conclusion:
<root> <somechild child-id="1"> <is-child-of> <node name="node1" /> <node name="node3" /> </is-child-of> </somechild> <somechild child-id="2"> <is-child-of> <node name="node2" /> <node name="node4" /> </is-child-of> </somechild> <somechild child-id="3"> <is-child-of> <node name="node5" /> </is-child-of> </somechild> </root>
The idea is that if it is the same element in many nodes, they have the same child identifier. I need to find everything that everyone uses. I found this question XSLT conversion to xml, grouping by key , which looks similar, but at the beginning there is a declaration of all authors, and I donβt have them, it is always just a child.
Pax0r
source share