Hi Christian, as usual, you're very helpful! One more example of how it can really help to pay attention to those function signatures -- I wasn't thinking about the http:response as a sequence, so thank you very much for that insight! Best, Bridger On Mon, Oct 28, 2019 at 10:13 PM Christian Grün <christian.gruen@gmail.com> wrote:
Hi Bridger,
http:send-request(<http:request method='get' href=' http://export.arxiv.org/oai2?verb=Identify'/>)/h:response/@status fails.
The reason is that http:send-request returns an http:response element as first item. "/h:response" is just another writing for "/child::h:response", As the response has no other response child, you won’t get any result. This is what you can do instead:
1. Use the self axis:
let $data := http:send-request(<http:request method='get' href='http://export.arxiv.org/oai2?verb=Identify'/>) return $data/self::http:response/@status
2. Return the status attribute from the first result (which will always be the http:response element):
let $data := http:send-request(<http:request method='get' href='http://export.arxiv.org/oai2?verb=Identify'/>) return head($data)/@status
Hope this helps, Christian