1

たとえば、次の XML があります。

<?xml version="1.0" encoding="utf-8"?>
<root>
    <row>
        <Type>1</Type>
        <WeaNr_ArtNr>100027</WeaNr_ArtNr>
        <UID>101114557945</UID>
    </row>
    <row>
        <Type>2</Type>
        <WeaNr_ArtNr>2000311</WeaNr_ArtNr>
        <UID>101114557945</UID>
        <UnitQuantity>10</UnitQuantity>
    </row>
    <row>
        <Type>1</Type>
        <WeaNr_ArtNr>100027</WeaNr_ArtNr>
        <UID>101114557946</UID>
    </row>
<row>
    <Type>2</Type>
    <WeaNr_ArtNr>2000312</WeaNr_ArtNr>
    <UID>101114557946</UID>
    <UnitQuantity>10</UnitQuantity>
</row>
    <row>
        <Type>1</Type>
        <WeaNr_ArtNr>55555</WeaNr_ArtNr>
        <UID>101114558000</UID>
    </row>
    <row>
        <Type>2</Type>
        <WeaNr_ArtNr>200053155555</WeaNr_ArtNr>
        <UID>101114558000</UID>
        <UnitQuantity>1</UnitQuantity>
    </row>
    <row>
        <Type>1</Type>
        <WeaNr_ArtNr>55555</WeaNr_ArtNr>
        <UID>101114558001</UID>
    </row>
    <row>
        <Type>2</Type>
        <WeaNr_ArtNr>200053255555</WeaNr_ArtNr>
        <UID>101114558001</UID>
        <UnitQuantity>1</UnitQuantity>
    </row>
        <row>
        <Type>1</Type>
        <WeaNr_ArtNr>100023</WeaNr_ArtNr>
        <UID>101114557989</UID>
    </row>
    <row>
        <Type>2</Type>
        <WeaNr_ArtNr>2000274</WeaNr_ArtNr>
        <UID>101114557989</UID>
        <UnitQuantity>14</UnitQuantity>
    </row>
    <row>
        <Type>1</Type>
        <WeaNr_ArtNr>100023</WeaNr_ArtNr>
        <UID>101114557990</UID>
    </row>
    <row>
        <Type>2</Type>
        <WeaNr_ArtNr>2000275</WeaNr_ArtNr>
        <UID>101114557990</UID>
        <UnitQuantity>23</UnitQuantity>
    </row>
</root>

WeaNr_ArtNrケースの値を知ることで、Type='1'次のノードを返したい

たとえば、WeaNr_ArtNr='100027' 次のノードを取得したい:

<row>
    <Type>2</Type>
    <WeaNr_ArtNr>2000311</WeaNr_ArtNr>
    <UID>101114557945</UID>
    <UnitQuantity>10</UnitQuantity>
</row>
<row>
    <Type>2</Type>
    <WeaNr_ArtNr>2000312</WeaNr_ArtNr>
    <UID>101114557946</UID>
    <UnitQuantity>10</UnitQuantity>
</row>

これらのノードはノードの後に​​移動するため、WeaNr_ArtNr='100027'

私はこのようなことを試しました

/root/row[WeaNr_ArtNr='100023']/preceding::row[WeaNr_ArtNr!='100023']

しかし、うまくいきません...

4

1 に答える 1

1

したがって、次の各行の直後の行が必要WeaNr_ArtNr='100027'ですか? ではどうでしょうか

/root/row[WeaNr_ArtNr='100027']/following-sibling::row[1]
于 2013-08-01T11:41:55.140 に答える