Add Normalization of subject-long for other fields that d600
[pazpar2-moved-to-github.git] / etc / solr-pz2.xsl
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
3                 xmlns:pz="http://www.indexdata.com/pazpar2/1.0" >
4
5   <xsl:param name="medium" />
6
7   <xsl:template  match="/">
8       <xsl:apply-templates></xsl:apply-templates>
9   </xsl:template>
10
11   <xsl:template match="doc">
12     <pz:record>
13       <xsl:apply-templates></xsl:apply-templates>
14     </pz:record>
15   </xsl:template>
16
17   <xsl:template match="str[@name]">
18     <pz:metadata>
19         <xsl:attribute  name="type">
20           <xsl:value-of select="@name"/>
21         </xsl:attribute>
22         <xsl:value-of select="."/>
23     </pz:metadata>
24   </xsl:template>
25
26   <xsl:template match="arr">
27     <xsl:for-each select="str">
28       <xsl:call-template name="string"/>
29     </xsl:for-each>
30   </xsl:template>
31
32   <xsl:template name="string">
33       <pz:metadata>
34         <xsl:attribute  name="type">
35           <xsl:value-of select="../@name"/>
36         </xsl:attribute>
37         <xsl:choose>
38           <xsl:when test="../@name = 'medium' and string-length($medium) > 0">
39             <xsl:value-of select="$medium"/>
40           </xsl:when>
41           <xsl:otherwise>
42             <xsl:value-of select="."/>
43           </xsl:otherwise>
44         </xsl:choose>
45       </pz:metadata>
46   </xsl:template>
47
48 </xsl:stylesheet>