我的XML看起来如下所示。我想在// book // genre / text()='classic'时检查'number'的值,我想要返回1000和1003.有人可以帮忙吗?
<list>
<book>
<author>
<name>John</name>
<number>1000</number>
</author>
<otherDetails>
<genre>classic</genre>
<price>$50</price>
</otherDetails>
<title>Dusk</title>
<isbn>dsdaassda</isbn>
</book>
<book>
<author>
<name>MARK</name>
<number>1001</number>
</author>
<otherDetails>
<genre>comedy</genre>
<price>$140</price>
</otherDetails>
<title>Midnight</title>
<isbn>dsdaassda</isbn>
</book>
<book>
<author>
<name>Pete</name>
<number>1003</number>
</author>
<otherDetails>
<genre>classic</genre>
<price>$140</price>
</otherDetails>
<title>Morning</title>
<isbn>EFGH</isbn>
</book>
答案 0 :(得分:4)
/list/book[otherDetails/genre='classic']/author/number