source: exist/trunk/xquery/atom2DC.xq @ 4436

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/exist/trunk/xquery/atom2DC.xq@4436
Revision 4436, 1.2 KB checked in by cbyrom, 12 years ago (diff)

Remove unneccesary xquery libs from xqueries + fix moles2dif - removing
hidden characters which stopped it from running.

Line 
1(: Create a dublin core document from Atom documents in TargetCollection which have LocalID :)
2declare default element namespace 'http://www.w3.org/2005/Atom';
3declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';
4declare namespace dc='http://purl.org/dc/elements/1.1/';
5declare namespace oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc/';
6declare namespace moles="http://ndg.nerc.ac.uk/schema/moles2alpha";
7
8declare variable $targetCollection as xs:string := 'TargetCollection';
9declare variable $localIdentifier as xs:string := 'LocalID';
10
11for $DE in collection($targetCollection)/entry[matches(id, concat('__ATOM__',$localIdentifier,'$'))]
12return
13element oai_dc:dc {
14    attribute xsi:schemaLocation {'http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'},
15    element dc:title {string($DE/title)},
16    element dc:type {'Dataset'},
17    element dc:identifier {tokenize(string($DE/id), '__ATOM__')[2]},
18    element dc:description {string($DE/summary)},
19    element dc:date {string($DE/updated)},
20    element dc:creator {string($DE/author/name)},
21    element dc:publisher {string($DE/moles:entity/moles:molesISO/moles:providerID)}
22}
Note: See TracBrowser for help on using the repository browser.