Commit 7c0f5497 authored by Dennis Neumann's avatar Dennis Neumann
Browse files

Add fields for places

parent b0f8b80c
......@@ -18,6 +18,7 @@
<xsl:value-of select="text/@xml:id" />
</field>
<xsl:apply-templates select="teiHeader/fileDesc/titleStmt/title" mode="text_only" />
<xsl:apply-templates select="teiHeader/fileDesc/titleStmt/title[@type='desc']/name" mode="make_field" />
<xsl:apply-templates select="teiHeader/fileDesc/titleStmt/author/name" mode="text_only" />
<field name="fulltext">
<xsl:apply-templates select="text/body/*" mode="text_only" />
......@@ -38,6 +39,18 @@
</field>
</xsl:template>
<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>
<xsl:template match="name[@type='place']" mode="text_only">
<xsl:apply-templates select="*|text()" mode="text_only" />
</xsl:template>
......
......@@ -35,6 +35,20 @@ public class XsltTest {
System.out.println(outputBaos.toString());
}
@Test
public void destinationPlace() throws Exception {
String result = transform("place_destination.xml");
assertXpathEvaluatesTo("Weimar", "//field[@name='destination_place']", result);
}
@Test
public void originPlace() throws Exception {
String result = transform("place_origin.xml");
assertXpathEvaluatesTo("Berlin", "//field[@name='origin_place']", result);
}
@Test
public void author() throws Exception {
String result = transform("author.xml");
......
<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title type="desc"> My title <name type="place" subtype="dtn" ref="gnd:123">Weimar</name></title>
</titleStmt>
</fileDesc>
</teiHeader>
<text xml:id="my_id" xml:lang="ger">
<body>
</body>
</text>
</TEI>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title type="desc"><name type="place" subtype="orn" ref="gnd:123">Berlin</name> My title</title>
</titleStmt>
</fileDesc>
</teiHeader>
<text xml:id="my_id" xml:lang="ger">
<body>
</body>
</text>
</TEI>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<teiHeader>
<fileDesc>
<titleStmt>
<title type="desc">My <name type="place">Berlin</name> title</title>
<title type="desc">My <name type="place" subtype="orn">Berlin</name> title</title>
</titleStmt>
</fileDesc>
</teiHeader>
......
......@@ -52,6 +52,8 @@
<field name="short_title" type="text_de" multiValued="false" />
<field name="title" type="text_de" multiValued="false" />
<field name="author" type="text_de" multiValued="false" />
<field name="origin_place" type="text_de" multiValued="false" />
<field name="destination_place" type="text_de" multiValued="false" />
<!-- transaction log -->
<field name="_version_" type="long" indexed="true" stored="true" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment