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

Add fields for keywords

parent 5a94addf
......@@ -30,7 +30,7 @@
<!--########### Header #######################-->
<xsl:template match="teiHeader">
<xsl:apply-templates select="fileDesc" />
<xsl:apply-templates select="fileDesc | profileDesc/textClass" />
</xsl:template>
<xsl:template match="fileDesc">
......@@ -41,6 +41,10 @@
<xsl:apply-templates select="sourceDesc" />
</xsl:template>
<xsl:template match="profileDesc/textClass">
<xsl:apply-templates select="keywords/term" />
</xsl:template>
<xsl:template match="title[@type='short']">
<field name="short_title">
<xsl:apply-templates mode="text_only" />
......@@ -89,6 +93,19 @@
</field>
</xsl:template>
<xsl:template match="textClass/keywords[@scheme='#gnd']/term">
<field name="gnd_keyword">
<xsl:apply-templates mode="text_only" />
</field>
</xsl:template>
<xsl:template match="textClass/keywords[@scheme='free']/term">
<field name="free_keyword">
<xsl:apply-templates mode="text_only" />
</field>
</xsl:template>
<!--################### text/body ##########################-->
......
......@@ -35,6 +35,22 @@ public class XsltTest {
System.out.println(outputBaos.toString());
}
@Test
public void freeKeywords() throws Exception {
String result = transform("keywords_free.xml");
assertXpathEvaluatesTo("Handschrift", "//field[@name='free_keyword'][1]", result);
assertXpathEvaluatesTo("Apparat", "//field[@name='free_keyword'][2]", result);
}
@Test
public void gndKeywords() throws Exception {
String result = transform("keywords_gnd.xml");
assertXpathEvaluatesTo("Brief", "//field[@name='gnd_keyword'][1]", result);
assertXpathEvaluatesTo("Goethe", "//field[@name='gnd_keyword'][2]", result);
}
@Test
public void sourceDescription() throws Exception {
String result = transform("sourceDesc.xml");
......
<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<profileDesc>
<textClass>
<keywords scheme="free">
<term>Handschrift</term>
<term>Apparat</term>
</keywords>
</textClass>
</profileDesc>
</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>
<profileDesc>
<textClass>
<keywords scheme="#gnd">
<term ref="gnd:123">Brief</term>
<term ref="gnd:123">Goethe</term>
</keywords>
</textClass>
</profileDesc>
</teiHeader>
<text xml:id="my_id" xml:lang="ger">
<body>
</body>
</text>
</TEI>
\ No newline at end of file
......@@ -57,6 +57,8 @@
<field name="destination_place" type="text_de" multiValued="false" />
<field name="origin_date" type="date" />
<field name="source_description" type="text_de" multiValued="true" />
<field name="gnd_keyword" type="text_de" multiValued="true" />
<field name="free_keyword" type="text_de" multiValued="true" />
<!-- 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