Skip to content

Instantly share code, notes, and snippets.

@CliffordAnderson
Created October 27, 2017 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CliffordAnderson/362ba922b5f56454f2b773dbc043e520 to your computer and use it in GitHub Desktop.
Save CliffordAnderson/362ba922b5f56454f2b773dbc043e520 to your computer and use it in GitHub Desktop.
XQuery Session - 10/26/2017
xquery version "3.1";
declare default element namespace "http://www.w3.org/1999/xhtml";
declare namespace ead = "urn:isbn:1-931666-22-9";
declare function local:get-titles($collection as xs:string) as element(p)*
{
let $titles := fn:collection($collection)/ead:ead/ead:eadheader/ead:filedesc/ead:titlestmt/ead:titleproper[@type="filing"]/text()
for $title in $titles
order by $title
return <p>{$title}</p>
};
declare function local:template($title as xs:string, $h1 as xs:integer, $ead-titles as element(p)*) as element(html) {
<html>
<head>
<title>{$title || " - "}</title>
</head>
<body>
<h1>{$h1 + 1}</h1>
<div>{$ead-titles}</div>
</body>
</html>
};
let $title := "Title of tab"
let $ead-titles := local:get-titles("FinalizedEADs")
let $h1 := 1
let $p := "I'm now creating a paragraph with some info in it."
return local:template($title, $h1, $ead-titles)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment