source: ndgCommon/trunk/ndg/common/xmldb/xquery/DIF2DC.xq @ 5604

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/ndgCommon/trunk/ndg/common/xmldb/xquery/DIF2DC.xq@5604
Revision 5604, 945 bytes checked in by sdonegan, 10 years ago (diff)

Added a dif2dc xquery so can produce DC from DIFs on exist atom feed - so we can produce compliant OAI discovery records from content in feed.

Line 
1(: Return a specific DC document converting from the DIF present :)
2
3declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/';
4
5declare namespace dc='http://purl.org/dc/elements/1.1/';
6declare namespace oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc/';
7declare variable $targetCollection as xs:string := 'TargetCollection';
8declare variable $localIdentifier as xs:string := 'RepositoryID:DIF:LocalID';
9
10for $DE in collection($targetCollection)/DIF[Entry_ID=$localIdentifier] return
11
12element oai_dc:dc {
13    attribute xsi:schemaLocation {'http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'},
14    element dc:title {data($DE/Entry_Title)},
15    element dc:type {'dataset'},
16    element dc:identifier {replace(data($DE/Entry_ID),":DIF:","__DC__")},
17    element dc:description {data($DE/Summary)},
18    element dc:date {data($DE/DIF_Revision_History)}   
19}
20
21
Note: See TracBrowser for help on using the repository browser.