How to get the title of the thickest book from XML-file via Xquery? -


i have xml-file next structure:

<books>   <book topic="databases" ebook = "available">     <pablisher>wrox</pablisher>     <title>microsoft sql server 2008 integration services: problem, design, solution</title>     <authors>       <author>erik veerman</author>       <author>jessica m. moss</author>       <author>brian knight</author>       <author>jay hackney</author>     </authors>       <isbn>978-0-470-52576-0</isbn>       <pages>480</pages>       <publicationdate>november 2009</publicationdate>       <price>49.99</price>   </book>   </books> 

there lot of books , have return title of thickest one. thing know how find max num of pages:

max(for $x in doc("c:\xmlfile1.xml")/books/book/pages return $x) 

but next step absolutely unclear me. thank in advance.

what want take max value , find book part of

let $doc =     doc("c:\xmlfile1.xml") let $pages := max($doc/books/book/pages)  return $doc/books/book[pages = $pages] 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -