Hi, I just changed the input as below.
__DATA__ <enhancement> <descriptorgroup> <descriptors type="MED" controlled="y"> <descriptor> <mainterm weight="a">plague</mainterm> <mainterm>disease</mainterm> <mainterm>pestilence</mainterm> <link>f</link> <link>C</link> <link>M</link> </descriptor> </descriptors> <descriptors type="DRG" controlled="y"> <mainterm>panadol</mainterm> <mainterm weight="a">zorro</mainterm> <mainterm>xenon</mainterm> <mainterm weight="a">aspirin</mainterm> <link>b</link> <link>P</link> <link>z</link> </descriptors> </descriptorgroup> </enhancement>
Most of it is going fine, but one thing I noticed is that it’s moving the position of “mainterm” as well. This won’t work because the xsd/dtd says that <mainterm> must come first, and then the <linkterm>s which are related to it. What is happening at the moment is that it is arrange ALL the tags alphabetically, <mainterm> and <linkterm>. How can this be controlled by the code?
<enhancement> <descriptorgroup> <descriptors controlled="y" type="DRG"> <link>P</link> <mainterm weight="a">aspirin</mainterm> <link>b</link> <mainterm>panadol</mainterm> <mainterm>xenon</mainterm> <link>z</link> <mainterm weight="a">zorro</mainterm> </descriptors> <descriptors controlled="y" type="MED"> <descriptor> <link>C</link> <link>M</link> <mainterm>disease</mainterm> <link>f</link> <mainterm>pestilence</mainterm> <mainterm weight="a">plague</mainterm> </descriptor> </descriptors> </descriptorgroup> </enhancement>
In reply to Re^3: twig inbuilt methods to sort whole xml tree
by bharathinc
in thread twig inbuilt methods to sort whole xml tree
by bharathinc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |