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

Fix unit tests

parent 4d87e7d0
......@@ -188,9 +188,9 @@ Furthermore, a warning message is generated that contains data of the first occu
<xsl:for-each-group select="descendant::node()[not(node())]" group-starting-with="pb">
<xsl:if test="self::pb">
<div class="page">
<div class="page-beginning">
<xsl:value-of select="self::pb/@n" />
</div>
<xsl:call-template name="page-beginning-with-possible-link">
<xsl:with-param name="current-pb" select="." />
</xsl:call-template>
<xsl:apply-templates select="$context/*" mode="page_splitting">
<xsl:with-param name="restricted-to" select="current-group()/ancestor-or-self::node()" tunnel="yes" />
</xsl:apply-templates>
......@@ -453,7 +453,7 @@ Furthermore, a warning message is generated that contains data of the first occu
<xsl:text>_page</xsl:text>
<xsl:value-of select="$pageNumber" />
</field>
<field name="article_id">
<field name="article_id">
<xsl:value-of select="$context/../../@xml:id" />
</field>
<field name="doctype">page</field>
......@@ -463,9 +463,9 @@ Furthermore, a warning message is generated that contains data of the first occu
<field name="html_page">
<xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
<div class="page">
<div class="page-beginning">
<xsl:value-of select="self::pb/@n" />
</div>
<xsl:call-template name="page-beginning-with-possible-link">
<xsl:with-param name="current-pb" select="." />
</xsl:call-template>
<xsl:apply-templates select="$context/*" mode="page_splitting">
<xsl:with-param name="restricted-to" select="current-group()/ancestor-or-self::node()" tunnel="yes" />
</xsl:apply-templates>
......@@ -477,6 +477,30 @@ Furthermore, a warning message is generated that contains data of the first occu
</xsl:for-each-group>
</xsl:template>
<xsl:template name="page-beginning-with-possible-link">
<xsl:param name="current-pb" />
<div class="page-beginning">
<xsl:variable name="facsId" select="substring($current-pb/@facs, 2, string-length($current-pb/@facs))" />
<xsl:variable name="graphicUrl" select="id($facsId)/@url" />
<xsl:variable name="graphicUrlWithoutJpg">
<xsl:value-of select="if (ends-with($graphicUrl, '.jpg')) then substring($graphicUrl, 1, string-length($graphicUrl)-4) else $graphicUrl" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$current-pb/@n ne '' and $graphicUrlWithoutJpg">
<a href="{concat('/', $graphicUrlWithoutJpg)}" target="_blank">
<xsl:value-of select="$current-pb/@n" />
</a>
</xsl:when>
<xsl:when test="$current-pb/@n ne ''">
<xsl:value-of select="$current-pb/@n" />
</xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<xsl:template match="pb" mode="page_splitting" />
<xsl:template match="*" mode="page_splitting">
......
......@@ -93,7 +93,7 @@ public class XsltHtmlTest {
public void softHyphen_convertsToMinus() throws Exception {
String html = transform("invisible-softhyphen-0173.xml");
assertXpathEvaluatesTo("auf- und ab", "//div[@class='article']", html);
assertXpathEvaluatesTo(" auf- und ab", "//div[@class='article']", html);
}
@Test
......
......@@ -60,7 +60,7 @@ public class XsltTest {
public void pageBreak_makesSpace() throws Exception {
String result = transform("page-break.xml");
assertXpathEvaluatesTo("before after ", "//field[@name='fulltext']", result);
assertXpathEvaluatesTo(" before after ", "//field[@name='fulltext']", result);
}
@Test
......@@ -174,7 +174,7 @@ public class XsltTest {
public void note_removesIfIsAComment() throws Exception {
String result = transform("note-comment.xml");
assertXpathEvaluatesTo("before-note after-note ", "//field[@name='fulltext']", result);
assertXpathEvaluatesTo(" before-note after-note ", "//field[@name='fulltext']", result);
}
@Test
......
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