I've a XML structure like this:

```
<root>
    <element>
        <name>Foo</name>
        <subelement>
             <key>1.1</key>
             <value>Lorem ipsum</value>
        </subelement>
        <subelement>
             <key>1.2</key>
             <value>Lorem ipsum dolor</value>
        </subelement>
    </element>
    <element>
        <name>Bar</name>
        <subelement>
             <key>7.3.4</key>
             <value>Seven three four</value>
        </subelement>
        <subelement>
             <key>7.3.8</key>
             <value>Seven three eight</value>
        </subelement>
        <subelement>
             <key>7.1</key>
             <value>Seven one</value>
        </subelement>
    </element>
</root>

```

What I try to achieve is to remove all `<subelement>`s except the one with the "highest" key.
I can't seem to find any way to compare the `<key>`s of the `<subelements>`s within a certain `<element>`.

The resulting XML would look like:

```
<root>
    <element>
        <name>Foo</name>
        <subelement>
             <key>1.2</key>
             <value>Lorem ipsum dolor</value>
        </subelement>
    </element>
    <element>
        <name>Bar</name>
        <subelement>
             <key>7.3.8</key>
             <value>Seven three eight</value>
        </subelement>
    </element>
</root>

```

Any hints are very welcome.