|
39
|
1 <?xml version='1.0'?>
|
|
|
2 <!DOCTYPE doc SYSTEM "../../../../lib/xml/xsl.dtd" >
|
|
|
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:x="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="x">
|
|
|
4 <!-- Convert a Corpus Thomisticum Latin file into one with true divs,
|
|
|
5 replacing existing divs with h2/h3 -->
|
|
40
|
6
|
|
|
7 <xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="file:///c:/cygwin/usr/local/share/lib/xml/xhtml1-transitional.dtd"/>
|
|
39
|
8 <xsl:template match="node()|@*">
|
|
|
9 <xsl:copy>
|
|
|
10 <xsl:apply-templates select="node()|@*"/>
|
|
|
11 </xsl:copy>
|
|
|
12 </xsl:template>
|
|
|
13
|
|
|
14 <xsl:template match="x:body">
|
|
|
15 <xsl:copy>
|
|
|
16 <xsl:apply-templates select="x:a|x:div[@class='tres' or @class='uno' or @class='dos']|x:div[@class='centro'][1]"/>
|
|
|
17 <xsl:for-each-group select="x:p|x:div[not(@class='tres' or @class='uno' or @class='dos' or @class='centro')]" group-starting-with="x:div[@class='D']">
|
|
|
18 <xsl:variable name="n" select="substring-after(.,'Quaestio ')"/>
|
|
41
|
19 <xsl:message><xsl:if test="position()=1"><xsl:text> </xsl:text><xsl:value-of select="last()"/><xsl:text> questions:
|
|
|
20 </xsl:text></xsl:if><xsl:text> Question </xsl:text><xsl:value-of select="$n"/></xsl:message>
|
|
39
|
21 <div class="q" id="q{$n}">
|
|
|
22 <h2><xsl:apply-templates/></h2>
|
|
40
|
23 <xsl:for-each-group select="current-group()[position()>1]" group-starting-with="x:div">
|
|
|
24 <xsl:choose>
|
|
|
25 <xsl:when test="@class='G'">
|
|
|
26 <div class="p">
|
|
|
27 <h3><xsl:apply-templates/></h3>
|
|
|
28 <xsl:apply-templates select="current-group()[position()>1]"/>
|
|
|
29 </div>
|
|
|
30 </xsl:when>
|
|
|
31 <xsl:otherwise>
|
|
|
32 <div class="a">
|
|
|
33 <h3><xsl:apply-templates/></h3>
|
|
|
34 <xsl:apply-templates select="current-group()[position()>1]"/>
|
|
|
35 </div>
|
|
|
36 </xsl:otherwise>
|
|
|
37 </xsl:choose>
|
|
|
38 </xsl:for-each-group>
|
|
|
39
|
|
|
40
|
|
39
|
41 </div>
|
|
|
42 </xsl:for-each-group>
|
|
|
43 <xsl:apply-templates select="x:div[@class='centro'][2]"/>
|
|
|
44 </xsl:copy>
|
|
|
45 </xsl:template>
|
|
|
46 </xsl:stylesheet>
|