view summa/latin/wrap.xsl @ 78:e182d4ea85ca

*** empty log message ***
author ht
date Sun, 10 Jan 2010 15:13:57 +0000
parents 9dd8ca02f93c
children
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" xmlns:x="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="x">
 <!-- Convert a Corpus Thomisticum Latin file into one with true divs,
       replacing existing divs with h2/h3 -->
 
 <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"/>
 <xsl:template match="node()|@*">
  <xsl:copy>
   <xsl:apply-templates select="node()|@*"/>
  </xsl:copy>
 </xsl:template>
 
 <xsl:template match="x:body">
  <xsl:copy>
   <xsl:apply-templates select="x:a|x:div[@class='tres' or @class='uno' or @class='dos']|x:div[@class='centro'][1]"/>
  <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']">
   <xsl:variable name="n" select="substring-after(.,'Quaestio ')"/>
   <xsl:message><xsl:if test="position()=1"><xsl:text> </xsl:text><xsl:value-of select="last()"/><xsl:text> questions:
</xsl:text></xsl:if><xsl:text>  Question </xsl:text><xsl:value-of select="$n"/></xsl:message>
  <div class="q" id="q{$n}">
   <h2><xsl:apply-templates/></h2>
   <xsl:for-each-group select="current-group()[position()>1]" group-starting-with="x:div">
    <xsl:choose>
     <xsl:when test="@class='G'">
      <div class="p">
       <h3><xsl:apply-templates/></h3>
       <xsl:apply-templates select="current-group()[position()>1]"/>
      </div>
     </xsl:when>
     <xsl:otherwise>
      <div class="a">
       <h3><xsl:apply-templates/></h3>
       <xsl:apply-templates select="current-group()[position()>1]"/>
      </div>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:for-each-group>
   
       
  </div>
  </xsl:for-each-group>
   <xsl:apply-templates select="x:div[@class='centro'][2]"/>
  </xsl:copy>
 </xsl:template>
</xsl:stylesheet>