Mercurial > hg > Aquinas
comparison summa/bilingual/fixup_e.xsl @ 54:77921d86a058
towards new format, pipeline
| author | ht |
|---|---|
| date | Tue, 29 Dec 2009 18:40:48 +0000 |
| parents | 2bff41f49349 |
| children |
comparison
equal
deleted
inserted
replaced
| 53:d777cc3962f2 | 54:77921d86a058 |
|---|---|
| 1 <?xml version='1.0'?> | 1 <?xml version='1.0'?> |
| 2 <!DOCTYPE doc SYSTEM "../../../../lib/xml/xsl.dtd" > | 2 <!DOCTYPE doc SYSTEM "../../../../lib/xml/xsl.dtd" > |
| 3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> | 3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:x="http://www.w3.org/1999/xhtml" exclude-result-prefixes="x" xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | 4 |
| 5 <xsl:output doctype-system="../../dtd/ThML10.dtd"/> | 5 <xsl:output method="xhtml"/> |
| 6 | |
| 7 <xsl:template match="x:p[not(text())]"/><!-- These mess up the count later --> | |
| 6 | 8 |
| 7 <xsl:template match="node()|@*"> | 9 <xsl:template match="node()|@*"> |
| 8 <xsl:copy> | 10 <xsl:copy> |
| 9 <xsl:apply-templates select="node()|@*"/> | 11 <xsl:apply-templates select="node()|@*"/> |
| 10 </xsl:copy> | 12 </xsl:copy> |
| 11 </xsl:template> | 13 </xsl:template> |
| 12 | 14 |
| 13 <!-- Next three should not be necessary, but the -expand:off switch doesn't seem to be working in Saxon 9 --> | 15 <xsl:template match="x:div[@class='div3']"> |
| 14 <xsl:template match="p/@shownumber[.='no']"/> | 16 <!-- Doc elt. |
| 15 | 17 Collect the splayed out questions at the beginning of each Question |
| 16 <xsl:template match="a/@shape[.='rect']"/> | 18 (Loses some empty <a...> at the beginning --> |
| 17 | |
| 18 <xsl:template match="a/@xml:link[.='simple']"/> <!-- ! bogus, but hard to fix --> | |
| 19 | |
| 20 <xsl:template match="div4[not(div/*[@xml:lang='la']) | |
| 21 and div/p[@xml:lang='en' | |
| 22 and not(b)]]"> | |
| 23 <!-- 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 | |
| 24 has latin already --> | |
| 25 <xsl:copy> | |
| 26 <xsl:apply-templates select="@*|h4"/> | |
| 27 <xsl:for-each-group select="div/p" group-starting-with="p[*[1][self::b]]"> | |
| 28 <!--<xsl:message><xsl:value-of select="../../@id"/>: <xsl:value-of select="position()"/>,<xsl:value-of select="count(current-group())"/></xsl:message>--> | |
| 29 <xsl:text> </xsl:text> | |
| 30 <div class="bilingual"> | |
| 31 <xsl:text> </xsl:text> | |
| 32 <xsl:choose> | |
| 33 <xsl:when test="current-group()[2]"> | |
| 34 <div xml:lang="en"> | |
| 35 <xsl:text> </xsl:text> | |
| 36 <xsl:apply-templates select="current-group()"/> | |
| 37 <xsl:text> </xsl:text> | |
| 38 </div> | |
| 39 </xsl:when> | |
| 40 <xsl:otherwise> | |
| 41 <xsl:apply-templates select="current-group()"/> | |
| 42 </xsl:otherwise> | |
| 43 </xsl:choose> | |
| 44 <xsl:text> </xsl:text> | |
| 45 </div> | |
| 46 </xsl:for-each-group> | |
| 47 <xsl:text> </xsl:text> | |
| 48 </xsl:copy> | |
| 49 </xsl:template> | |
| 50 | |
| 51 <xsl:template match="div3[div[2]]"> | |
| 52 <!-- Try to detect the splayed out questions at the beginning of each Question --> | |
| 53 <xsl:copy> | 19 <xsl:copy> |
| 54 <xsl:apply-templates select="@*"/> | 20 <xsl:apply-templates select="@*"/> |
| 55 <xsl:text> </xsl:text> | 21 <xsl:text> </xsl:text> |
| 56 <xsl:apply-templates select="h3"/> | 22 <xsl:apply-templates select="x:h3"/> |
| 57 <xsl:text> </xsl:text> | 23 <xsl:text> </xsl:text> |
| 58 <div class="bilingual"> | 24 <div class="div4"> |
| 59 <xsl:text> </xsl:text> | 25 <xsl:text> </xsl:text> |
| 60 <div xml:lang="en"> | 26 <xsl:apply-templates select="x:p"/> |
| 61 <xsl:text> </xsl:text> | |
| 62 <xsl:apply-templates select="div/p"/> | |
| 63 <xsl:text> </xsl:text> | |
| 64 </div> | |
| 65 <xsl:text> </xsl:text> | 27 <xsl:text> </xsl:text> |
| 66 </div> | 28 </div> |
| 67 <xsl:text> </xsl:text> | 29 <xsl:text> </xsl:text> |
| 68 <xsl:apply-templates select="div4"/> | 30 <xsl:apply-templates select="x:div"/> |
| 69 </xsl:copy> | 31 </xsl:copy> |
| 70 </xsl:template> | 32 </xsl:template> |
| 71 </xsl:stylesheet> | 33 </xsl:stylesheet> |
