Commit d0be207e authored by Dennis Neumann's avatar Dennis Neumann
Browse files

Add author field

parent dc902464
......@@ -12,7 +12,7 @@
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="TEI">
<add>
<doc>
......@@ -20,13 +20,14 @@
<xsl:value-of select="$currentArticleId" />
</field>
<xsl:apply-templates select="teiHeader/fileDesc/titleStmt/title" mode="text_only" />
<xsl:apply-templates select="teiHeader/fileDesc/titleStmt/author/name" mode="text_only" />
<field name="fulltext">
<xsl:apply-templates select="text/body/*" mode="text_only" />
</field>
</doc>
</add>
</xsl:template>
<xsl:template match="title[@type='short']" mode="text_only">
<field name="short_title">
<xsl:apply-templates select="*|text()" mode="text_only" />
......@@ -43,6 +44,12 @@
<xsl:apply-templates select="*|text()" mode="text_only" />
</xsl:template>
<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>
<xsl:template match="p" mode="text_only">
<xsl:apply-templates select="*|text()" mode="text_only" />
</xsl:template>
......
......@@ -35,6 +35,13 @@ public class XsltTest {
System.out.println(outputBaos.toString());
}
@Test
public void author() throws Exception {
String result = transform("author.xml");
assertXpathEvaluatesTo("Some author", "//field[@name='author']", result);
}
@Test
public void fullTitleWithSpaces_replacesWithOneSpace() throws Exception {
String result = transform("title_full_with_many_spaces.xml");
......
<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<author><name type="person" subtype="aut">Some author</name></author>
</titleStmt>
</fileDesc>
</teiHeader>
<text xml:id="my_id" xml:lang="ger">
<body>
</body>
</text>
</TEI>
\ No newline at end of file
......@@ -51,6 +51,7 @@
<field name="fulltext" type="text_de" multiValued="false" />
<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" />
<!-- 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