aje89
aje89

Reputation: 13

XPATH get node based of value of another node

Im trying to filter an XML File based on the value of the node

    <MIME_INFO>
                <MIME>
                    <MIME_TYPE>image/jpeg</MIME_TYPE>
                    <MIME_SOURCE>image1.jpg</MIME_SOURCE>
                    </MIME>
                <MIME>
                    <MIME_TYPE>image/jpeg</MIME_TYPE>
                    <MIME_SOURCE>image2.jpg</MIME_SOURCE>

                </MIME>
                <MIME>
                    <MIME_TYPE>application/pdf</MIME_TYPE>
                    <MIME_SOURCE>document.pdf</MIME_SOURCE>
                </MIME>
    </MIME_INFO>

im using the following XPATH Function

{MIME_INFO/MIME/MIME_SOURCE[./MIME_TYPE='image/jpeg']}

i want to get the value of MIME_SOURCE based on the value of the MIME_TYPE node.

I don´t get any output from this query.

Thanks in advance

Upvotes: 1

Views: 36

Answers (1)

OldProgrammer
OldProgrammer

Reputation: 12169

You want this:

/MIME_INFO/MIME[MIME_TYPE='image/jpeg']/MIME_SOURCE

Upvotes: 1

Related Questions