summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--convert.xsl15
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>