gfl-indexer.xslt 3.23 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
   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="/">
Dennis Neumann's avatar
Dennis Neumann committed
11
12
      <xsl:apply-templates />
   </xsl:template>
Dennis Neumann's avatar
Dennis Neumann committed
13

Dennis Neumann's avatar
Dennis Neumann committed
14
   <xsl:template match="TEI">
15
16
17
      <add>
         <doc>
            <field name="id">
18
               <xsl:value-of select="text/@xml:id" />
19
            </field>
Dennis Neumann's avatar
Dennis Neumann committed
20
            <xsl:apply-templates select="teiHeader/fileDesc/titleStmt/title" mode="text_only" />
Dennis Neumann's avatar
Dennis Neumann committed
21
            <xsl:apply-templates select="teiHeader/fileDesc/titleStmt/title[@type='desc']/name" mode="make_field" />
Dennis Neumann's avatar
Dennis Neumann committed
22
            <xsl:apply-templates select="teiHeader/fileDesc/titleStmt/title[@type='desc']/date[@type='orn']" mode="make_field" />
Dennis Neumann's avatar
Dennis Neumann committed
23
            <xsl:apply-templates select="teiHeader/fileDesc/titleStmt/author/name" mode="text_only" />
24
            <field name="fulltext">
25
               <xsl:apply-templates select="text/body/*" mode="text_only" />
26
27
28
29
            </field>
         </doc>
      </add>
   </xsl:template>
Dennis Neumann's avatar
Dennis Neumann committed
30

Dennis Neumann's avatar
Dennis Neumann committed
31
32
33
34
35
36
37
38
39
40
41
42
   <xsl:template match="title[@type='short']" mode="text_only">
      <field name="short_title">
         <xsl:apply-templates select="*|text()" mode="text_only" />
      </field>
   </xsl:template>

   <xsl:template match="title[@type='desc']" mode="text_only">
      <field name="title">
         <xsl:apply-templates select="*|text()" mode="text_only" />
      </field>
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
43
44
45
46
47
48
49
50
51
52
53
54
   <xsl:template match="name[@type='place' and @subtype='orn']" mode="make_field">
      <field name="origin_place">
         <xsl:apply-templates select="*|text()" mode="text_only" />
      </field>
   </xsl:template>

   <xsl:template match="name[@type='place' and @subtype='dtn']" mode="make_field">
      <field name="destination_place">
         <xsl:apply-templates select="*|text()" mode="text_only" />
      </field>
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
55
56
57
58
59
60
61
62
63
64
65
66
   <xsl:template match="name[@type='person' and @subtype='rcp']" mode="make_field">
      <field name="recipient">
         <xsl:apply-templates select="*|text()" mode="text_only" />
      </field>
   </xsl:template>

   <xsl:template match="date[@type='orn']" mode="make_field">
      <field name="origin_date">
         <xsl:value-of select="@when" />
      </field>
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
67
68
69
   <xsl:template match="name[@type='place']" mode="text_only">
      <xsl:apply-templates select="*|text()" mode="text_only" />
   </xsl:template>
70

Dennis Neumann's avatar
Dennis Neumann committed
71
72
73
74
75
76
   <xsl:template match="name[@type='person' and @subtype='aut']" mode="text_only">
      <field name="author">
         <xsl:apply-templates select="*|text()" mode="text_only" />
      </field>
   </xsl:template>

77
78
   <xsl:template match="p" mode="text_only">
      <xsl:apply-templates select="*|text()" mode="text_only" />
79
80
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
81
   <xsl:template match="text()" mode="#all">
82
      <xsl:value-of select="replace(., '\s+', ' ')" />
83
84
   </xsl:template>

85
   <xsl:template match="lb" mode="text_only">
86
87
      <xsl:text> </xsl:text>
   </xsl:template>
Dennis Neumann's avatar
Dennis Neumann committed
88

89
   <xsl:template match="note[@type='com']" mode="text_only">
90
91
   </xsl:template>

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