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

Add extra field for comments

parent a8d48d53
......@@ -183,6 +183,7 @@ Furthermore, a warning message is generated that contains data of the first occu
</div>
<xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
</field>
<xsl:apply-templates select=".//note[@type='com']" />
</xsl:template>
<xsl:template match="body | div" mode="text_only">
......@@ -222,6 +223,12 @@ Furthermore, a warning message is generated that contains data of the first occu
<xsl:template match="note[@type='com']" mode="text_only">
</xsl:template>
<xsl:template match="note[@type='com']">
<field name="note_comment">
<xsl:apply-templates mode="text_only" />
</field>
</xsl:template>
<!-- ++++++++++++ HTML +++++++++++++++++++ -->
......
......@@ -39,21 +39,21 @@ public class XsltTest {
public void differentHyphensAtLinebreak() throws Exception {
String result = transform("hyphens.xml");
assertXpathEvaluatesTo("Worttrennung soft hyphen: - New sentence. Anna-Lena ", "//field[@name='fulltext'][1]", result);
assertXpathEvaluatesTo("Worttrennung soft hyphen: - New sentence. Anna-Lena ", "//field[@name='fulltext']", result);
}
@Test
public void pageBreak_makesSpace() throws Exception {
String result = transform("page-break.xml");
assertXpathEvaluatesTo("before after ", "//field[@name='fulltext'][1]", result);
assertXpathEvaluatesTo("before after ", "//field[@name='fulltext']", result);
}
@Test
public void spaceLines_addsSpaceInText() throws Exception {
String result = transform("spaceLines_withText.xml");
assertXpathEvaluatesTo("myopener myparagraph ", "//field[@name='fulltext'][1]", result);
assertXpathEvaluatesTo("myopener myparagraph ", "//field[@name='fulltext']", result);
}
@Test
......@@ -142,6 +142,20 @@ public class XsltTest {
assertXpathEvaluatesTo("My short title", "//field[@name='short_title']", result);
}
@Test
public void note_makesExtraField() throws Exception {
String result = transform("note-comment.xml");
assertXpathEvaluatesTo("A note.", "//field[@name='note_comment']", result);
}
@Test
public void noteWithRef_makesExtraField() throws Exception {
String result = transform("note-comment_with-ref.xml");
assertXpathEvaluatesTo("A note in ref.", "//field[@name='note_comment']", result);
}
@Test
public void note_removesIfIsAComment() throws Exception {
String result = transform("note-comment.xml");
......
<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
</teiHeader>
<text xml:id="my_id" xml:lang="ger">
<body>
<div>
<p>before-note<note type="com"><ref target="bla">A note in ref.</ref></note> after-note</p>
</div>
</body>
</text>
</TEI>
\ No newline at end of file
......@@ -60,6 +60,7 @@
<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" />
<field name="note_comment" type="text_de" multiValued="true" />
<field name="all_header_fields" type="text_de" multiValued="true" />
<copyField source="id" dest="all_header_fields" />
......
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