For my homework i got asked in XPATH a question that i can't response. Here is the question "Provide an XPath expression which, from a element, returns the number of people after (in document order) that whose postal code is the current node."
<addressbook xmlns="https://esi-bru.be/WEBR4"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="https://esi-bru.be/WEBR4 addressbook.xsd">
    <persons>
        <person id='p1'>
            <identity>
                <lastname>Loiselle</lastname>
                <firstnames>
                    <firstname>Raymond</firstname>
                    <firstname>Claude</firstname>
                </firstnames>
                <sex>MALE</sex>
                <birth>1991-10-15</birth>
                <death>NULL</death>
            </identity>
            <addresses>
                <postal>
                    <country_id>BE</country_id>
                    <postalcode>4850</postalcode>
                    <city>Plombières</city>
                    <street>Rue Basse</street>
                    <number>113</number>
                </postal>
                <emails>
                    <email use='PROFESSIONAL'>natoque.penatibus@loremipsumsodales.org</email>
                    <email use='PRIVATE'>id@lacusMaurisnon.net</email>
                </emails>
                <phones>
                    <phone use='PRIVATE' type='LANDLINE'>042082616</phone>
                    <phone use='PRIVATE' type='CELLPHONE'>0497806590</phone>
                    <phone use='PROFESSIONAL' type='LANDLINE'>022966411</phone>
                    <phone use='PROFESSIONAL' type='IPPHONE'>082648320</phone>
                </phones>
            </addresses>
            <relations>
                <relation>
                    <person_id>p3</person_id>
                    <level>1</level>
                </relation>
                <relation>
                    <person_id>p7</person_id>
                    <level>-1</level>
                </relation>
                <relation>
                    <person_id>p12</person_id>
                    <level>0</level>
                </relation>
                <relation>
                    <person_id>p5</person_id>
                    <level>3</level>
                </relation>
            </relations>
        </person>
        <person id='p2'>
            <identity>
                <lastname>Frueh</lastname>
                <firstnames>
                    <firstname>Andreas</firstname>
                </firstnames>
                <sex>MALE</sex>
                <birth>1984-04-15</birth>
                <death>NULL</death>
            </identity>
            <addresses>
                <postal>
                    <country_id>DE</country_id>
                    <postalcode>4850</postalcode>
                    <city>Vettelschoß</city>
                    <street>Wallstrasse</street>
                    <number>21</number>
                </postal>
                <emails>
                    <email use='PRIVATE'>Aenean.eget@etlibero.net</email>
                    <email use='PROFESSIONAL'>Proin.nisl.sem@vitaevelitegestas.edu</email>
                </emails>
                <phones>
                    <phone use='PRIVATE' type='LANDLINE'>03327839582</phone>
                    <phone use='PRIVATE' type='CELLPHONE'>017436797167</phone>
                    <phone use='PROFESSIONAL' type='LANDLINE'>07056419296</phone>
                    <phone use='PROFESSIONAL' type='IPPHONE'>09747178748</phone>
                </phones>
            </addresses>
            <relations>
                <relation>
                    <person_id>p14</person_id>
                    <level>4</level>
                </relation>
                <relation>
                    <person_id>p1</person_id>
                    <level>2</level>
                </relation>
                <relation>
                    <person_id>p3</person_id>
                    <level>-1</level>
                </relation>
                <relation>
                    <person_id>p10</person_id>
                    <level>1</level>
                </relation>
                <relation>
                    <person_id>p11</person_id>
                    <level>1</level>
                </relation>
                <relation>
                    <person_id>p6</person_id>
                    <level>2</level>
                </relation>
                <relation>
                    <person_id>p5</person_id>
                    <level>2</level>
                </relation>
            </relations>
        </person>
        <person id='p3'>
            <identity>
                <lastname>Diederich</lastname>
                <firstnames>
                    <firstname>Juliane</firstname>
                </firstnames>
                <sex>FEMALE</sex>
                <birth>1963-12-23</birth>
                <death>2005-05-02</death>
            </identity>
            <addresses>
                <postal>
                    <country_id>DE</country_id>
                    <postalcode>56414</postalcode>
                    <city>Oberahr</city>
                    <street>Stuttgarter Platz</street>
                    <number>75</number>
                </postal>
                <emails>
                    <email use='PRIVATE'>Aenean.eget@etlibero.net</email>
                </emails>
                <phones/>
            </addresses>
            <relations>
                <relation>
                    <person_id>p12</person_id>
                    <level>4</level>
                </relation>
                <relation>
                    <person_id>p11</person_id>
                    <level>4</level>
                </relation>
                <relation>
                    <person_id>p1</person_id>
                    <level>4</level>
                </relation>
            </relations>
        </person>
    </persons>
</addressbook>
I started a request but i don't fully understand how . works and what would be my current node. how could i compare with all other nodes from the same type in the order without taking the one that have a position() < the postalcode that i'm comparing to the other.
request:
//postalcode/(count(./text() = //person/addresses/postal/postalcode/text()))
I do not necessarily ask for a correction of the request but more to be able to better understand certain concepts to be able to answer it.
Sorry for my bad english btw..
 
     
     
    