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%27/%3E)/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:
- Use the self axis:
let $data := http:send-request(<http:request method='get' href='http://export.arxiv.org/oai2?verb=Identify%27/%3E) return $data/self::http:response/@status
- 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%27/%3E) return head($data)/@status
Hope this helps, Christian