Mercurial > hg > Aquinas
view summa/bilingual/fixup_e.xsl @ 17:2bff41f49349
automated grouping, Question 13 merged
| author | ht |
|---|---|
| date | Mon, 08 Dec 2008 23:15:50 +0000 |
| parents | |
| children | 77921d86a058 |
line wrap: on
line source
<?xml version='1.0'?> <!DOCTYPE doc SYSTEM "../../../../lib/xml/xsl.dtd" > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output doctype-system="../../dtd/ThML10.dtd"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <!-- Next three should not be necessary, but the -expand:off switch doesn't seem to be working in Saxon 9 --> <xsl:template match="p/@shownumber[.='no']"/> <xsl:template match="a/@shape[.='rect']"/> <xsl:template match="a/@xml:link[.='simple']"/> <!-- ! bogus, but hard to fix --> <xsl:template match="div4[not(div/*[@xml:lang='la']) and div/p[@xml:lang='en' and not(b)]]"> <!-- Try to detect cases where a single sub-part (typically the respondeo) is spread over multiple paras, and merge them. Don't mess with anything that has latin already --> <xsl:copy> <xsl:apply-templates select="@*|h4"/> <xsl:for-each-group select="div/p" group-starting-with="p[*[1][self::b]]"> <!--<xsl:message><xsl:value-of select="../../@id"/>: <xsl:value-of select="position()"/>,<xsl:value-of select="count(current-group())"/></xsl:message>--> <xsl:text> </xsl:text> <div class="bilingual"> <xsl:text> </xsl:text> <xsl:choose> <xsl:when test="current-group()[2]"> <div xml:lang="en"> <xsl:text> </xsl:text> <xsl:apply-templates select="current-group()"/> <xsl:text> </xsl:text> </div> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="current-group()"/> </xsl:otherwise> </xsl:choose> <xsl:text> </xsl:text> </div> </xsl:for-each-group> <xsl:text> </xsl:text> </xsl:copy> </xsl:template> <xsl:template match="div3[div[2]]"> <!-- Try to detect the splayed out questions at the beginning of each Question --> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:text> </xsl:text> <xsl:apply-templates select="h3"/> <xsl:text> </xsl:text> <div class="bilingual"> <xsl:text> </xsl:text> <div xml:lang="en"> <xsl:text> </xsl:text> <xsl:apply-templates select="div/p"/> <xsl:text> </xsl:text> </div> <xsl:text> </xsl:text> </div> <xsl:text> </xsl:text> <xsl:apply-templates select="div4"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
