<?xml version="1.0" encoding="UTF-8" ?>
<!-- ADLIB to Peoples Network Discovery Service (PNDS) XML cross-walk
Reference for mapping (draft, non-persitient URL) at:  http://www.ukoln.ac.uk/twiki/bin/view/Metadata/PNDSApplicationProfile
Version: 1.2
Date: 28Oct05
Shaun Osborne, Fitzwilliam Museum, University of Cambridge
CHANGES
19Oct05 - PNDS launched today without telling us (*sigh*) - anyway...
          fixed AA titles to be title OR object category and name
          fixed space between title an translated title for paintings
28Oct05 - Tidying post PNDS launch before asking MLA to harvest again changes include:
          - Painting titles re-arranges so translated title comes first if available
          - MSS, CM and Ant will output title into dc:title now if they ever have one
          - removed title and translate_title from description as its just a duplication of whats in dc:title
          - dc:description: category, name, technique & technique description concatenated together under 'classification(s)' sub-heading
          - dc:description: dates fixed so if early=late only display early, fixed up spacing around 'circas'
          - dc:description: title maker as 'Artist:' ad changed display so maker, role and ULAn data display more 'nicely' together
          - dc:description: C&M does it own set of fields titled under 'classification(s)'
          - dc:description: improved logic to deal with separators when fields missing (e.g maker in antiquities)
          - dc:description: 'second' description filed (the real description field from ADLIB) labelled as description
          
-->
<xsl:stylesheet version="1.0"   
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:dc="http://purl.org/dc/elements/1.1/">
  <xsl:output method="html" />
  
  <xsl:template match="/">    
    <xsl:apply-templates select="adlibXML/recordList/record" />      
  </xsl:template>
  
  <xsl:template match="record">
    <pndsdc:description
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:dcterms="http://purl.org/dc/terms/"
         xmlns:pndsterms="http://purl.org/mla/pnds/terms/"
         xmlns:pndsdc="http://purl.org/mla/pnds/pndsdc/"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://purl.org/mla/pnds/pndsdc/
                             http://www.ukoln.ac.uk/metadata/pns/pndsdcxml/2005-06-13/xmls/pndsdc.xsd">

<!--dc:identifier (required)-->
      <!--dc:identifier ><xsl:value-of select="object_number"/></dc:identifier-->
      <dc:identifier encSchemeURI="http://purl.org/dc/terms/URI">http://www.fitzmuseum.cam.ac.uk/opacdirect/<xsl:value-of select="priref"/>.html</dc:identifier>

<!--dc:title (required)-->
<dc:title>
      <xsl:if test="administration_name = 'Paintings, Drawings and Prints'">
        <xsl:if test="translated_title != ''"><xsl:value-of select="translated_title"/></xsl:if><xsl:text></xsl:text>
        <xsl:if test="title != '' and normalize-space(translated_title) != ''"><xsl:text> </xsl:text>(<xsl:value-of select="title"/>)</xsl:if>
        <xsl:if test="title != '' and normalize-space(translated_title) = ''"><xsl:value-of select="title"/></xsl:if>      
      </xsl:if>
      <xsl:if test="administration_name = 'Applied Arts'">
      <xsl:if test="title != ''"><xsl:value-of select="title"/><xsl:text> </xsl:text></xsl:if>
      <xsl:if test="normalize-space(title) = ''"><xsl:value-of select="normalize-space(object_category)"/><xsl:text>, </xsl:text><xsl:value-of select="object_name"/></xsl:if>
      </xsl:if>
      <xsl:if test="administration_name = 'Coins and Medals'">
        <xsl:if test="title != ''"><xsl:value-of select="title"/><xsl:text> </xsl:text></xsl:if>
        <xsl:if test="object_category != ''"><xsl:value-of select="normalize-space(object_category)"/></xsl:if>
        <xsl:if test="object_name != ''"><xsl:for-each select="object_name">, <xsl:value-of select="."/></xsl:for-each></xsl:if>
      </xsl:if>
      <xsl:if test="administration_name = 'Manuscripts and Printed Books'">
        <xsl:if test="title != ''"><xsl:value-of select="title"/><xsl:text> </xsl:text></xsl:if>
        <xsl:if test="normalize-space(title) = ''">
        <xsl:if test="object_category != ''"><xsl:value-of select="normalize-space(object_category)"/></xsl:if>
        <xsl:if test="normalize-space(object_name) != ''"><xsl:for-each select="object_name">, <xsl:value-of select="."/></xsl:for-each></xsl:if>
        </xsl:if>
      </xsl:if>
      <xsl:if test="administration_name = 'Antiquities'">
        <xsl:if test="title != ''"><xsl:value-of select="title"/><xsl:text> </xsl:text></xsl:if>
        <xsl:if test="object_category != ''"><xsl:value-of select="normalize-space(object_category)"/></xsl:if>
        <xsl:if test="object_name != ''"><xsl:for-each select="object_name">, <xsl:value-of select="."/></xsl:for-each></xsl:if>
      </xsl:if>
</dc:title>
      
<!--dc:description (required)-->
      <!--xsl:if test = "description = ''"-->
      <dc:description>
<xsl:if test = "maker/name != ''">Artist:<xsl:text> </xsl:text><xsl:value-of select="maker/name"/>
        <xsl:if test = "maker_role != ''"><xsl:text>, </xsl:text><xsl:value-of select="normalize-space(maker_role)"/></xsl:if>
        <xsl:if test = "normalize-space(maker/bn) != ''"><xsl:text> - </xsl:text><xsl:value-of select="maker/bn"/></xsl:if>
      </xsl:if>
      <xsl:if test = "normalize-space(production_place) != ''">
        <xsl:if test = "maker/name != ''">;</xsl:if>
        Production Place: <xsl:value-of select="production_place"/>
      </xsl:if>
      <xsl:if test = "date_early != '' or date_late != ''">; Date(s): <xsl:if test = "date_early_precision != ''"><xsl:value-of select="date_early_precision"/><xsl:text> </xsl:text></xsl:if><xsl:value-of select="date_early"/>
        <xsl:if test = "date_late != date_early">
        <xsl:text> - </xsl:text>
        <xsl:if test = "date_late_precision != ''"><xsl:value-of select="date_late_precision"/><xsl:text> </xsl:text></xsl:if>
        <xsl:if test = "date_late != ''"><xsl:value-of select="date_late"/></xsl:if></xsl:if>
      </xsl:if>
      <xsl:if test="administration_name = 'Coins and Medals'">
        <xsl:if test="object_category != ''">; Classification(s): <xsl:value-of select="normalize-space(object_category)"/></xsl:if>
        <xsl:if test="object_name != ''"><xsl:for-each select="object_name">, <xsl:value-of select="."/></xsl:for-each></xsl:if>
      </xsl:if>
      <xsl:if test="administration_name != 'Coins and Medals'">
        <xsl:if test = "object_category != ''">; Classification(s): <xsl:value-of select="object_category"/></xsl:if>
        <xsl:if test = "object_name != ''">, <xsl:value-of select="object_name"/></xsl:if>
        <xsl:if test = "technique != ''">, <xsl:value-of select="technique"/></xsl:if>
        <xsl:if test = "Technique_Desc != ''">, <xsl:value-of select="Technique_Desc"/></xsl:if>
      </xsl:if>
      
      <xsl:if test = "normalize-space(acquisition_method) != ''">; Acquisition: <xsl:value-of select="acquisition_method"/>
        <xsl:if test = "acquired_from != ''"> by <xsl:value-of select="acquired_from"/></xsl:if>
        <xsl:if test = "acquisition_date != ''">, <xsl:value-of select="acquisition_date"/></xsl:if>
      </xsl:if>
      <xsl:if test = "normalize-space(acquisition_method) = '' and normalize-space(credit_line) != ''">
            <xsl:text>Credits:  </xsl:text><xsl:value-of select="credit_line"/>
      </xsl:if>
      <xsl:if test = "normalize-space(acquisition_method) != '' and normalize-space(credit_line) != ''">, <xsl:value-of select="credit_line"/>.</xsl:if>
      <xsl:if test = "credit_line = ''">.</xsl:if><!-- do the ending full-stop if no credit line -->
      </dc:description>
      <!--/xsl:if-->
      <xsl:if test = "description != ''"><dc:description>Description: <xsl:value-of select="description"/></dc:description></xsl:if>
      
<!--dc:type (required)-->
	  <dc:type encSchemeURI="http://purl.org/dc/terms/DCMIType">Text</dc:type>
    <xsl:if test = "image_reference != ''">
    <dc:type encSchemeURI="http://purl.org/dc/terms/DCMIType">Image</dc:type>
    </xsl:if>

<!--dc:rights, dcterms:licence, dcterms:rightsHolder (required) -->
    <dcterms:license valueURI="http://www.fitzmuseum.cam.ac.uk/terms.htm" />
    <!--dcterms:license valueURI="http://creativecommons.org/licenses/by/2.0/uk/" /-->
    <dcterms:rightsHolder>The Fitzwilliam Museum, Cambridge, UK</dcterms:rightsHolder>

<!-- end of PNDS required fields -->



<!-- start of PNDS recommended fields -->

<!--dc:subject (recommended)-->
   <xsl:if test = "object_category != ''"><dc:subject><xsl:value-of select="normalize-space(object_category)"/></dc:subject></xsl:if>
   <xsl:if test = "object_name != '' and object_name != object_category"><dc:subject><xsl:value-of select="normalize-space(object_name)"/></dc:subject></xsl:if>
   <xsl:if test = "maker/name != ''"><dc:subject><xsl:value-of select="normalize-space(maker/name)"/></dc:subject></xsl:if>
    <!--xsl:if test = "association_keyword != ''"><what><xsl:value-of select="normalize-space(association_keyword)"/></what></xsl:if>
	  <xsl:if test = "association_date != ''"><when><xsl:value-of select="normalize-space(association_date)"/></when></xsl:if>
	  <xsl:if test = "association_period != ''"><what><xsl:value-of select="normalize-space(association_period)"/></what></xsl:if>
	  <xsl:if test = "association_person != ''"><who><xsl:value-of select="normalize-space(association_person)"/></who></xsl:if>
	  <xsl:if test = "association_object != ''"><what><xsl:value-of select="normalize-space(association_object)"/></what></xsl:if>
	  <xsl:if test = "association_activity != ''"><what><xsl:value-of select="normalize-space(association_activity)"/></what></xsl:if>
	  <xsl:if test = "association_event != ''"><what><xsl:value-of select="normalize-space(association_event)"/></what></xsl:if>
	  <xsl:if test = "association_place != ''"><where><xsl:value-of select="normalize-space(association_place)"/></where></xsl:if>
	  <xsl:if test = "association_notes != ''"><what><xsl:value-of select="normalize-space(association_notes)"/></what></xsl:if>
	  <xsl:if test = "content_position != ''"><what><xsl:value-of select="normalize-space(content_position)"/></what></xsl:if>
	  <xsl:if test = "content_concept != ''"><what><xsl:value-of select="normalize-space(content_concept)"/></what></xsl:if>
	  <xsl:if test = "content_date != ''"><when><xsl:value-of select="normalize-space(content_date)"/></when></xsl:if>
	  <xsl:if test = "content_period != ''"><what><xsl:value-of select="normalize-space(content_period)"/></what></xsl:if>
	  <xsl:if test = "content_person != ''"><who><xsl:value-of select="normalize-space(content_person)"/></who></xsl:if>
	  <xsl:if test = "content_object != ''"><what><xsl:value-of select="normalize-space(content_object)"/></what></xsl:if>
	  <xsl:if test = "collection_place != ''"><where><xsl:value-of select="normalize-space(collection_place)"/></where></xsl:if>
	  <xsl:if test = "content_plant != ''"><what><xsl:value-of select="normalize-space(content_plant)"/></what></xsl:if>
	  <xsl:if test = "content_activity != ''"><what><xsl:value-of select="normalize-space(content_activity)"/></what></xsl:if>
	  <xsl:if test = "content_event != ''"><what><xsl:value-of select="normalize-space(content_event)"/></what></xsl:if>
	  <xsl:if test = "content_event_name != ''"><what><xsl:value-of select="normalize-space(content_event_name)"/></what></xsl:if>
    <xsl:if test = "content_place != ''"><where><xsl:value-of select="normalize-space(content_place)"/></where></xsl:if>
	  <xsl:if test = "content_local_name != ''"><where><xsl:value-of select="normalize-space(content_local_name)"/></where></xsl:if-->

<!--dc:creator (recommended)-->
      <dc:creator>The Fitzwilliam Museum, Cambridge, UK</dc:creator>

<!--dc:contributor (recommended)-->
      <!-- not used -->


<!--dc:publisher (recommended)-->
      <dc:publisher>The Fitzwilliam Museum, Cambridge, UK</dc:publisher>

<!--dc:language (recommended)-->
     <dc:language encSchemeURI="http://purl.org/dc/terms/RFC3066">en-GB</dc:language>

<!--dcterms:spatial (recommended)-->
      <!-- not used -->


<!--dcterms:temporal (recommended)-->
    <xsl:if test="date_early != '' and date_late != '' and date_period != ''">
    <dcterms:temporal encSchemeURI="http://purl.org/dc/terms/Period">name=<xsl:value-of select="normalize-space(date_period)"/>; start=<xsl:value-of select="date_early"/>; end=<xsl:value-of select="date_late"/></dcterms:temporal>
    </xsl:if>

<!--pndsterms:thumbnail (recommended)-->
    <xsl:if test = "image_reference != ''">
    <xsl:variable name="thumbnail" select='image_reference'/>
    <pndsterms:thumbnail valueURI="{$thumbnail}" ></pndsterms:thumbnail>
    </xsl:if>



<!-- start of PNDS optional fields -->

<!--dc:format-->
      <dc:format>text/html</dc:format>

<!--dc:date (not used)-->


   </pndsdc:description>

  </xsl:template>
  
</xsl:stylesheet>
