diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-06-28 15:25:10 +0200 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-06-28 15:25:10 +0200 |
commit | 7ea6867062569d9a439e4280a2b943212edafc54 (patch) | |
tree | 4eb8a065ce25e88e995c5623f3accbd379928502 | |
parent | a2dcb152c544c2ee5694475f81a34a684d02b557 (diff) | |
download | bible-fetch-7ea6867062569d9a439e4280a2b943212edafc54.tar.gz bible-fetch-7ea6867062569d9a439e4280a2b943212edafc54.tar.bz2 bible-fetch-7ea6867062569d9a439e4280a2b943212edafc54.zip |
convert.xsl: Fix caption vref if there is no following verse
-rw-r--r-- | convert.xsl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/convert.xsl b/convert.xsl index 8717512..c91e120 100644 --- a/convert.xsl +++ b/convert.xsl @@ -1,8 +1,19 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes" encoding="UTF-8" media-type="text/xml"/> - <xsl:template match="h2"> - <caption vref="{following::span[@class='verse']}"> + <xsl:template match="h2" mode="conv"> + <caption> + <xsl:attribute name="vref"> + <xsl:choose> + <xsl:when test="string-length(following::span[@class='verse']) > 0"> + <xsl:value-of select="following::span[@class='verse']"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="preceding::span[@class='verse']"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:apply-templates mode="copy" /> </caption> </xsl:template> |