SOLR document format to pz2 format
[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   <xsl:template  match="/">
5       <xsl:apply-templates></xsl:apply-templates>
6   </xsl:template>
7
8   <xsl:template match="doc">
9     <pz:record>
10       <xsl:apply-templates></xsl:apply-templates>
11     </pz:record>
12   </xsl:template>
13   <xsl:template match="str[@name]">
14     <pz:metadata>
15         <xsl:attribute  name="type">
16           <xsl:value-of select="@name"/>
17         </xsl:attribute>
18         <xsl:value-of select="."/>
19     </pz:metadata>
20   </xsl:template>
21
22   <xsl:template match="arr">
23     <xsl:for-each select="str">
24       <xsl:call-template name="string"/>
25     </xsl:for-each>
26   </xsl:template>
27
28   <xsl:template name="string">
29       <pz:metadata>
30         <xsl:attribute  name="type">
31           <xsl:value-of select="../@name"/>
32         </xsl:attribute>
33         <xsl:value-of select="."/>
34       </pz:metadata>
35   </xsl:template>
36
37 </xsl:stylesheet>