Towards PAZ-996.
authorMike Taylor <mike@indexdata.com>
Fri, 27 Mar 2015 12:13:32 +0000 (12:13 +0000)
committerMike Taylor <mike@indexdata.com>
Fri, 27 Mar 2015 12:13:32 +0000 (12:13 +0000)
Add rules to emit <license_name> elements alongside <license_url>.
This embodies our knowledge of the mapping from URLs to names.

At present, it supports the five different Creative Commons licences
in use by the first 1000 records of the University of East London
harvest. I will add support for other well-known licences soon.

etc/xsl/solr-pz2.xsl

index 5a11a53..50a2a89 100644 (file)
          </xsl:attribute>
          <xsl:value-of select="."/>
        </pz:metadata>
+       <xsl:if test="../@name='license_url'">
+        <pz:metadata type="license_name">
+         <xsl:choose>
+          <xsl:when test=". = 'http://creativecommons.org/licenses/by/4.0'">
+           CC By
+          </xsl:when>
+          <xsl:when test=". = 'http://creativecommons.org/licenses/by-nd/4.0'">
+           CC By-ND
+          </xsl:when>
+          <xsl:when test=". = 'http://creativecommons.org/licenses/by-nd-sa/4.0'">
+           CC By-ND-SA
+          </xsl:when>
+          <xsl:when test=". = 'http://creativecommons.org/licenses/by-nc/4.0'">
+           CC By-NC
+          </xsl:when>
+          <xsl:when test=". = 'http://creativecommons.org/licenses/by-nc-nd/4.0'">
+           CC By-NC-ND
+          </xsl:when>
+          <xsl:otherwise>
+           [unknown]
+          </xsl:otherwise>
+         </xsl:choose>
+        </pz:metadata>
+       </xsl:if>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>