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

Remove tabs and returns in the middle of strings

parent a8059d83
......@@ -21,7 +21,7 @@
</field>
<xsl:apply-templates select="teiHeader/fileDesc/titleStmt/title" mode="text_only" />
<field name="fulltext">
<xsl:apply-templates select="text/body/*" />
<xsl:apply-templates select="text/body/*" mode="text_only" />
</field>
</doc>
</add>
......@@ -43,19 +43,19 @@
<xsl:apply-templates select="*|text()" mode="text_only" />
</xsl:template>
<xsl:template match="p">
<xsl:apply-templates select="*|text()" />
<xsl:template match="p" mode="text_only">
<xsl:apply-templates select="*|text()" mode="text_only" />
</xsl:template>
<xsl:template match="text()" mode="#all">
<xsl:value-of select="." />
<xsl:value-of select="replace(., '\s+', ' ')" />
</xsl:template>
<xsl:template match="lb">
<xsl:template match="lb" mode="text_only">
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="note[@type='com']">
<xsl:template match="note[@type='com']" mode="text_only">
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
......@@ -35,6 +35,13 @@ public class XsltTest {
System.out.println(outputBaos.toString());
}
@Test
public void fullTitleWithSpaces_replacesWithOneSpace() throws Exception {
String result = transform("title_full_with_many_spaces.xml");
assertXpathEvaluatesTo("My title, with many spaces", "//field[@name='title']", result);
}
@Test
public void fullTitleWithPlace_createsField() throws Exception {
String result = transform("title_full_with_place.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,
with many spaces</title>
</titleStmt>
</fileDesc>
</teiHeader>
<text xml:id="my_id" xml:lang="ger">
<body>
</body>
</text>
</TEI>
\ No newline at end of file
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