Skip to content

Commit 5b9568f

Browse files
authored
Make parameters in abbyy2hocr.xsl optional
1 parent 0f4b305 commit 5b9568f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

abbyy2hocr.xsl

+9-5
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ see alternative https://gist.github.com/tfmorris/5977784
2626

2727

2828

29-
<xsl:param name="ImageFile_Path_and_ImageFile" required="yes"></xsl:param>
30-
<xsl:param name="ImageFile_format" required="yes"></xsl:param>
31-
<xsl:param name="CSS_Stylesheet" required="yes"></xsl:param>
29+
<xsl:param name="ImageFile_Path_and_ImageFile"></xsl:param>
30+
<xsl:param name="ImageFile_format"></xsl:param>
31+
<xsl:param name="CSS_Stylesheet"></xsl:param>
3232

3333
<xsl:variable name="document-uri" select="document-uri(.)"/>
3434

@@ -43,7 +43,9 @@ see alternative https://gist.github.com/tfmorris/5977784
4343
</xsl:text>
4444
<html>
4545
<head>
46-
<link rel="stylesheet"><xsl:attribute name="href"><xsl:value-of select="$CSS_Stylesheet"/></xsl:attribute></link>
46+
<xsl:if test="normalize-space($ImageFile_Path_and_ImageFile) != ''">
47+
<link rel="stylesheet"><xsl:attribute name="href"><xsl:value-of select="$CSS_Stylesheet"/></xsl:attribute></link>
48+
</xsl:if>
4749
<title>OCR Output</title>
4850
<meta name="description"><xsl:attribute name="content">OCR Output produced by <xsl:value-of select="./@producer"/></xsl:attribute></meta>
4951
</head>
@@ -62,7 +64,9 @@ see alternative https://gist.github.com/tfmorris/5977784
6264
<xsl:value-of select="@width" />
6365
<xsl:text> </xsl:text>
6466
<xsl:value-of select="@height" />
65-
<xsl:text> image </xsl:text><xsl:text> </xsl:text><xsl:value-of select="$ImageFile_Path_and_ImageFile"/>.<xsl:value-of select="$ImageFile_format"/><xsl:text></xsl:text>
67+
<xsl:if test="normalize-space($ImageFile_Path_and_ImageFile) != ''">
68+
<xsl:text> image </xsl:text><xsl:text> </xsl:text><xsl:value-of select="$ImageFile_Path_and_ImageFile"/>.<xsl:value-of select="$ImageFile_format"/><xsl:text></xsl:text>
69+
</xsl:if>
6670
</xsl:attribute>
6771
<xsl:apply-templates select="ns0:block|ns1:block|ns2:block|ns3:block" />
6872
</div>

0 commit comments

Comments
 (0)