gfl-indexer.xslt 4.03 KB
Newer Older
Dennis Neumann's avatar
Dennis Neumann committed
1
2
3
<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
5
6
7
   xpath-default-namespace="http://www.tei-c.org/ns/1.0" xmlns:gfl="http://sub.gfl.de"
   xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:saxon="http://saxon.sf.net/" exclude-result-prefixes="gfl saxon xs">

   <xsl:output method="xml" indent="yes" />
Dennis Neumann's avatar
Dennis Neumann committed
8
   <xsl:strip-space elements="*" />
Dennis Neumann's avatar
Dennis Neumann committed
9
   <xsl:preserve-space elements="msIdentifier bibl" />
10
11
12
13

   <xsl:template match="/">
      <add>
         <doc>
Dennis Neumann's avatar
Dennis Neumann committed
14
            <xsl:apply-templates select="TEI" />
15
16
17
         </doc>
      </add>
   </xsl:template>
Dennis Neumann's avatar
Dennis Neumann committed
18

Dennis Neumann's avatar
Dennis Neumann committed
19
20
21
22
23
   <xsl:template match="TEI">
      <xsl:apply-templates select="teiHeader | text" />
   </xsl:template>

   <xsl:template match="text()" mode="#all">
Dennis Neumann's avatar
Dennis Neumann committed
24
      <xsl:value-of select="replace(., '\s+', ' ')" />
Dennis Neumann's avatar
Dennis Neumann committed
25
26
27
28
29
   </xsl:template>
   
   <!--###########   Header   #######################-->
   
   <xsl:template match="teiHeader">
Dennis Neumann's avatar
Dennis Neumann committed
30
      <xsl:apply-templates select="fileDesc | profileDesc/textClass" />
Dennis Neumann's avatar
Dennis Neumann committed
31
32
33
34
35
36
37
   </xsl:template>
   
   <xsl:template match="fileDesc">
      <xsl:apply-templates select="titleStmt/title" />
      <xsl:apply-templates select="titleStmt/title[@type='desc']/name" />
      <xsl:apply-templates select="titleStmt/title[@type='desc']/date[@type='orn']" />
      <xsl:apply-templates select="titleStmt/author/name" />
38
      <xsl:apply-templates select="sourceDesc" />
Dennis Neumann's avatar
Dennis Neumann committed
39
40
   </xsl:template>
   
Dennis Neumann's avatar
Dennis Neumann committed
41
42
43
44
   <xsl:template match="profileDesc/textClass">
      <xsl:apply-templates select="keywords/term" />
   </xsl:template>
   
Dennis Neumann's avatar
Dennis Neumann committed
45
   <xsl:template match="title[@type='short']">
Dennis Neumann's avatar
Dennis Neumann committed
46
      <field name="short_title">
Dennis Neumann's avatar
Dennis Neumann committed
47
         <xsl:apply-templates mode="text_only" />
Dennis Neumann's avatar
Dennis Neumann committed
48
49
50
      </field>
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
51
   <xsl:template match="title[@type='desc']">
Dennis Neumann's avatar
Dennis Neumann committed
52
      <field name="title">
Dennis Neumann's avatar
Dennis Neumann committed
53
         <xsl:apply-templates mode="text_only" />
Dennis Neumann's avatar
Dennis Neumann committed
54
55
56
      </field>
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
57
   <xsl:template match="title/name[@type='place' and @subtype='orn']">
Dennis Neumann's avatar
Dennis Neumann committed
58
59
60
61
62
      <field name="origin_place">
         <xsl:apply-templates select="*|text()" mode="text_only" />
      </field>
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
63
   <xsl:template match="title/name[@type='place' and @subtype='dtn']">
Dennis Neumann's avatar
Dennis Neumann committed
64
      <field name="destination_place">
Dennis Neumann's avatar
Dennis Neumann committed
65
         <xsl:apply-templates mode="text_only" />
Dennis Neumann's avatar
Dennis Neumann committed
66
67
68
      </field>
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
69
   <xsl:template match="title/name[@type='person' and @subtype='rcp']">
Dennis Neumann's avatar
Dennis Neumann committed
70
      <field name="recipient">
Dennis Neumann's avatar
Dennis Neumann committed
71
         <xsl:apply-templates mode="text_only" />
Dennis Neumann's avatar
Dennis Neumann committed
72
73
74
      </field>
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
75
   <xsl:template match="title/date[@type='orn']">
Dennis Neumann's avatar
Dennis Neumann committed
76
77
78
79
80
      <field name="origin_date">
         <xsl:value-of select="@when" />
      </field>
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
81
   <xsl:template match="author/name[@type='person' and @subtype='aut']">
Dennis Neumann's avatar
Dennis Neumann committed
82
      <field name="author">
Dennis Neumann's avatar
Dennis Neumann committed
83
         <xsl:apply-templates mode="text_only" />
Dennis Neumann's avatar
Dennis Neumann committed
84
85
      </field>
   </xsl:template>
86
87
88
89
90
91
   
   <xsl:template match="sourceDesc">
      <field name="source_description">
         <xsl:apply-templates mode="text_only" />
      </field>
   </xsl:template>
Dennis Neumann's avatar
Dennis Neumann committed
92

Dennis Neumann's avatar
Dennis Neumann committed
93
94
95
96
97
98
99
100
101
102
103
104
105
   <xsl:template match="textClass/keywords[@scheme='#gnd']/term">
      <field name="gnd_keyword">
         <xsl:apply-templates mode="text_only" />
      </field>
   </xsl:template>

   <xsl:template match="textClass/keywords[@scheme='free']/term">
      <field name="free_keyword">
         <xsl:apply-templates mode="text_only" />
      </field>
   </xsl:template>


106

Dennis Neumann's avatar
Dennis Neumann committed
107
108
109
110
111
112
113
   <!--###################   text/body   ##########################-->

   <xsl:template match="text">
      <field name="id">
         <xsl:value-of select="@xml:id" />
      </field>
      <field name="fulltext">
Dennis Neumann's avatar
Dennis Neumann committed
114
         <xsl:apply-templates select="body" mode="text_only" />
Dennis Neumann's avatar
Dennis Neumann committed
115
      </field>
116
   </xsl:template>
Dennis Neumann's avatar
Dennis Neumann committed
117
118
119
120
121
122
123
124
125
   
   <xsl:template match="body | div" mode="text_only">
      <xsl:apply-templates select="*" mode="text_only"/>
   </xsl:template>

   <xsl:template match="p" mode="text_only">
      <xsl:apply-templates mode="text_only" />
      <xsl:text> </xsl:text>
   </xsl:template>
126

127
   <xsl:template match="lb" mode="text_only">
128
129
      <xsl:text> </xsl:text>
   </xsl:template>
Dennis Neumann's avatar
Dennis Neumann committed
130

131
   <xsl:template match="note[@type='com']" mode="text_only">
132
133
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
134
</xsl:stylesheet>