Skip to content

Commit

Permalink
Merge pull request #477 from dmj/t/fix-476-c
Browse files Browse the repository at this point in the history
Gracefully fail if target if @FACS does not exist
  • Loading branch information
peterstadler committed Jul 22, 2022
2 parents d7fe268 + e9bb141 commit 4349ef4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions epub/epub-common.xsl
Expand Up @@ -538,6 +538,9 @@ of this software, even if advised of the possibility of such damage.
<xsl:variable name="F">
<xsl:choose>
<xsl:when test="starts-with(@facs,'#')">
<xsl:if test="empty(id(substring(@facs, 2)))">
<xsl:message>The target '<xsl:value-of select="@facs"/>' is not defined in this document</xsl:message>
</xsl:if>
<xsl:for-each
select="id(substring(@facs,2))">
<xsl:value-of select="tei:resolveURI(.,descendant-or-self::*[@url][1]/@url)"/>
Expand All @@ -558,6 +561,9 @@ of this software, even if advised of the possibility of such damage.
<xsl:value-of select="tokenize($F,'\.')[last()]"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$F = ''">
<xsl:message>Unable to determine source file name of '<xsl:value-of select="@facs"/>'"</xsl:message>
</xsl:when>
<xsl:when test="contains($F,':')">
<get src="{$F}" dest="{$target}"/>
</xsl:when>
Expand Down
6 changes: 6 additions & 0 deletions tools/makegraphicsanttask.xsl
Expand Up @@ -95,6 +95,9 @@ of this software, even if advised of the possibility of such damage.
<xsl:variable name="F">
<xsl:choose>
<xsl:when test="starts-with(@facs,'#')">
<xsl:if test="empty(id(substring(@facs, 2)))">
<xsl:message>The target '<xsl:value-of select="@facs"/>' is not defined in this document</xsl:message>
</xsl:if>
<xsl:for-each
select="id(substring(@facs,2))">
<xsl:value-of select="tei:resolveURI(.,descendant-or-self::*[@url][1]/@url)"/>
Expand All @@ -115,6 +118,9 @@ of this software, even if advised of the possibility of such damage.
<xsl:value-of select="tokenize($F,'\.')[last()]"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$F = ''">
<xsl:message>Unable to determine source file name of '<xsl:value-of select="@facs"/>'"</xsl:message>
</xsl:when>
<xsl:when test="contains($F,':')">
<get src="{$F}" dest="{$target}"/>
</xsl:when>
Expand Down

0 comments on commit 4349ef4

Please sign in to comment.