gfl-indexer.xslt 3 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
8
9
10
11
12
   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" />
   <xsl:strip-space elements="*" />

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

Dennis Neumann's avatar
Dennis Neumann committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
   <xsl:template match="TEI">
      <xsl:apply-templates select="teiHeader | text" />
   </xsl:template>

 
   <xsl:template match="text()" mode="#all">
      <xsl:value-of select="replace(., '\s+', ' ')" />
   </xsl:template>

   
   <!--###########   Header   #######################-->
   
   <xsl:template match="teiHeader">
      <xsl:apply-templates select="fileDesc" />
   </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" />
   </xsl:template>
   
   <xsl:template match="title[@type='short']">
Dennis Neumann's avatar
Dennis Neumann committed
42
      <field name="short_title">
Dennis Neumann's avatar
Dennis Neumann committed
43
         <xsl:apply-templates mode="text_only" />
Dennis Neumann's avatar
Dennis Neumann committed
44
45
46
      </field>
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
47
   <xsl:template match="title[@type='desc']">
Dennis Neumann's avatar
Dennis Neumann committed
48
      <field name="title">
Dennis Neumann's avatar
Dennis Neumann committed
49
         <xsl:apply-templates mode="text_only" />
Dennis Neumann's avatar
Dennis Neumann committed
50
51
52
      </field>
   </xsl:template>

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

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

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

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

Dennis Neumann's avatar
Dennis Neumann committed
77
   <xsl:template match="author/name[@type='person' and @subtype='aut']">
Dennis Neumann's avatar
Dennis Neumann committed
78
      <field name="author">
Dennis Neumann's avatar
Dennis Neumann committed
79
         <xsl:apply-templates mode="text_only" />
Dennis Neumann's avatar
Dennis Neumann committed
80
81
82
      </field>
   </xsl:template>

83

Dennis Neumann's avatar
Dennis Neumann committed
84
85
86
87
88
89
90
91
92
   <!--###################   text/body   ##########################-->

   <xsl:template match="text">
      <field name="id">
         <xsl:value-of select="@xml:id" />
      </field>
      <field name="fulltext">
         <xsl:apply-templates select="body/*" mode="text_only" />
      </field>
93
94
   </xsl:template>

95
   <xsl:template match="lb" mode="text_only">
96
97
      <xsl:text> </xsl:text>
   </xsl:template>
Dennis Neumann's avatar
Dennis Neumann committed
98

99
   <xsl:template match="note[@type='com']" mode="text_only">
100
101
   </xsl:template>

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