gfl-indexer.xslt 1.92 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:param name="currentArticleId" />

   <xsl:template match="/">
Dennis Neumann's avatar
Dennis Neumann committed
13
14
15
16
      <xsl:apply-templates />
   </xsl:template>
   
   <xsl:template match="TEI">
17
18
19
20
21
      <add>
         <doc>
            <field name="id">
               <xsl:value-of select="$currentArticleId" />
            </field>
Dennis Neumann's avatar
Dennis Neumann committed
22
            <xsl:apply-templates select="teiHeader/fileDesc/titleStmt/title" mode="text_only" />
23
            <field name="fulltext">
24
               <xsl:apply-templates select="text/body/*" mode="text_only" />
25
26
27
28
            </field>
         </doc>
      </add>
   </xsl:template>
Dennis Neumann's avatar
Dennis Neumann committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
   
   <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>

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

46
47
   <xsl:template match="p" mode="text_only">
      <xsl:apply-templates select="*|text()" mode="text_only" />
48
49
   </xsl:template>

Dennis Neumann's avatar
Dennis Neumann committed
50
   <xsl:template match="text()" mode="#all">
51
      <xsl:value-of select="replace(., '\s+', ' ')" />
52
53
   </xsl:template>

54
   <xsl:template match="lb" mode="text_only">
55
56
      <xsl:text> </xsl:text>
   </xsl:template>
Dennis Neumann's avatar
Dennis Neumann committed
57

58
   <xsl:template match="note[@type='com']" mode="text_only">
59
60
   </xsl:template>

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