0

For example, I have an XML:

    <?xml version="1.0"?>
<list>
    <pos matnr="10017571" charg="1045825700" atwrt="108" labst="610" />
    <pos matnr="10017572" charg="1045825700" atwrt="108" labst="600" />
    <pos matnr="10017573" charg="1046186400" atwrt="108" labst="2730" />
    <pos matnr="10017573" charg="1046117000" atwrt="108" labst="5200" />
    <pos matnr="10017573" charg="1046055000" atwrt="108" labst="3507" />
    <pos matnr="10017574" charg="1045911400" atwrt="108" labst="50" />
    <pos matnr="10017574" charg="1046055000" atwrt="108" labst="14230" />
    <pos matnr="10017574" charg="1046117000" atwrt="108" labst="5500" />
    <pos matnr="10017574" charg="1046186400" atwrt="108" labst="2410" />
</list>

So, how can I select a node with specific value of one attribute and maximum value of another attribute in XPath? I need something like this (not works):

xmlDocZ.selectSingleNode("//pos[@matnr='10017574' and @labst[not(.>//@labst)]]");

Result must be:

<pos matnr="10017574" charg="1046055000" atwrt="108" labst="14230" />
Rundom
  • 87
  • 1
  • 7

1 Answers1

0

Oh, I got it by my self. This works fine:

xmlDocZ.selectSingleNode("//pos[@matnr='10017574' and @labst[not(.//pos[@matnr='10017574']/@labst)]]");
Rundom
  • 87
  • 1
  • 7