xquery version "1.0"; declare namespace m="http://www.loc.gov/mods/v3"; declare namespace mdc="http://mdcog.org/citeproc/in"; (: Load library modules :) declare namespace request="http://exist-db.org/xquery/request"; declare namespace xsl="http://exist-db.org/xquery/transform"; declare namespace util="http://exist-db.org/xquery/util"; declare namespace xdb="http://exist-db.org/xquery/xmldb"; let $x := xdb:register-database("org.exist.xmldb.DatabaseImpl", true()), $docid := request:request-parameter("docid",string("")), $doc := doc(concat("/db/mdc-public/",$docid)), $title := string($doc//m:titleInfo/m:title) return {$title} { for $resdocid in $doc//m:relatedItem[@type='constituent']/m:identifier let $ref := string($resdocid) return }