Source XML document:
<library>
<shelf>
<list>
<book>
<author>
<name>Name_001</name>
<number>Auth_001</number>
</author>
<title>Title_001</title>
<isbn>Isbn_001</isbn>
</book>
<book>
<author>
<name>Name_002</name>
<number>Auth_002</number>
</author>
<title>Title_002</title>
<isbn>Isbn_003</isbn>
</book>
<book>
<author>
<name>Name_003</name>
<number>Auth_003</number>
</author>
<title>Title_003</title>
<isbn>Isbn_003</isbn>
</book>
</list>
</shelf>
</library>
Xpath in Java to get the below output (example filter by author number) filter expression something similar "/library/shelf/list/book/author[number='Auth_002']"?
Output:
<library>
<shelf>
<list>
<book>
<author>
<name>Name_002</name>
<number>Auth_002</number>
</author>
<title>Title_002</title>
<isbn>Isbn_003</isbn>
</book>
</list>
</shelf>
</library>