Check a remote webpage for broken links, with XQuery and EXPath HTTP Client
xquery version "3.0";
import module namespace http = "http://expath.org/ns/http-client";
let $url := 'http://history.state.gov/education/modules/border-vanishes-intro'
let $links := doc($url)//*:a[ends-with(@href, '.pdf')]
return
<results n="{count($links)}">{
for $link in $links
let $href := if (starts-with($link/@href, '//')) then concat('http:', $link/@href) else $link/@href/string()
let $request := <http:request href="{$href}" method="head"/>
let $response := http:send-request($request)
return
<link>
<url>{$href}</url>
<status>{$response/@status/string()}</status>
</link>
}</results>