diff options
Diffstat (limited to 'convert.xsl')
-rw-r--r-- | convert.xsl | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/convert.xsl b/convert.xsl index dafae59..731452e 100644 --- a/convert.xsl +++ b/convert.xsl @@ -62,28 +62,43 @@ </xsl:choose> </xsl:template> --> - <xsl:template match="p[span/@class='verse']"> + + <xsl:template name="copy-until-next-verse"> + <xsl:apply-templates select="following-sibling::*[1]" mode="copy-until-next-verse" /> + </xsl:template> + <xsl:template name="copy-with-notes"> + <xsl:apply-templates select="text()|span[@class='fussnote']|em|br" mode="copy-with-notes" /> + <xsl:call-template name="copy-until-next-verse" /> + </xsl:template> + + <!-- Dont copy intermediate headers and annotations into verse --> + <xsl:template match="div[@class='annotation']|h2" mode="copy-until-next-verse"> + <xsl:call-template name="copy-until-next-verse"/> + </xsl:template> + + <xsl:template match="*" mode="copy-until-next-verse"> + <xsl:if test="not(span[@class = 'verse']) and not(@class='fussnote')"> + <xsl:text> </xsl:text> + <br art="x-nl" /> + <xsl:call-template name="copy-with-notes" /> + </xsl:if> + </xsl:template> + <xsl:template match="p[span/@class='verse']" mode="conv"> <vers> <xsl:attribute name="vnumber"> <xsl:value-of select="span[@class='verse']"/> </xsl:attribute> - <xsl:apply-templates select="text()|span[@class='fussnote']|em|br" mode="copy-with-notes" /> + <xsl:call-template name="copy-with-notes" /> + <!--<xsl:apply-templates select="*" mode="error" />--> </vers> </xsl:template> - <xsl:template match="div[@class='annotation']"> - </xsl:template> - - - <xsl:template match="div[@class='markdown']"> - <xsl:apply-templates select="*" /> - </xsl:template> - + <xsl:template match="*" mode="conv"/> <xsl:template match="/"> <chapter cnumber="{//span[@class='chapter']}"> - <xsl:apply-templates select="//div[@class='markdown']"/> + <xsl:apply-templates select="//div[@class='markdown']/*" mode="conv"/> </chapter> </xsl:template> |