poetry_print.xsl
branchstyles
changeset 4 301b54644bfa
parent 3 6e7e05c2ded6
child 6 a59023633201
--- a/poetry_print.xsl	Mon Jul 17 13:43:11 2006 -0400
+++ b/poetry_print.xsl	Mon Jul 17 13:43:22 2006 -0400
@@ -36,8 +36,8 @@
         </block>
       </static-content>
       <static-content flow-name="xsl-region-after">
-        <block border-before-style="solid">
-          <table width="100%" table-layout="fixed">
+        <block space-before="10mm" border-before-style="solid">
+          <table space-before="2mm" width="100%" table-layout="fixed">
             <table-column column-width="proportional-column-width(1)"
                   number-columns-repeated="2"/>
             <table-body>
@@ -59,38 +59,100 @@
 <xsl:template match="book">
   <root>
     <xsl:call-template name="master-set"/>
-    <xsl:apply-templates select="section"/>
+    <page-sequence master-reference="book-sequence">
+      <xsl:call-template name="static-content">
+	<xsl:with-param name="title">
+	  <xsl:apply-templates select="descendant::title[1]"/>
+	</xsl:with-param>
+      </xsl:call-template>
+      <xsl:variable name="id">
+	<xsl:call-template name="get-id"/>
+      </xsl:variable>
+      <flow flow-name="xsl-region-body">
+	<block id="{$id}"/>
+	<xsl:apply-templates select="*[name(.)!='section']"/>
+      </flow>
+    </page-sequence>
+    <xsl:apply-templates select="section"/> 
   </root>
 </xsl:template>
 
-<xsl:template match="/book/section">
+<xsl:template 
+    match="/book/section|section[poetry]|poetry|/book/addendum">
   <page-sequence master-reference="book-sequence">
     <xsl:call-template name="static-content">
       <xsl:with-param name="title">
-        <xsl:apply-templates select="title"/>
+	<xsl:choose>
+	  <xsl:when test="name(.)='preambule'">
+	    <xsl:text>Préambule</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="name(.)='addendum'">
+	    <xsl:text>Addendum</xsl:text>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:apply-templates select="descendant::title[1]"/>
+	  </xsl:otherwise>
+	</xsl:choose>
       </xsl:with-param>
     </xsl:call-template>
+    <xsl:variable name="id">
+      <xsl:call-template name="get-id"/>
+    </xsl:variable>
     <flow flow-name="xsl-region-body">
-      <xsl:apply-templates select="*[name()!='poetry']"/>
-    </flow>
+      <block id="{$id}"/>
+      <xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
+      <xsl:if test="section[poetry]">
+	<list-block text-indent="15mm" space-before="15pt">
+	  <xsl:apply-templates select="section[poetry]" mode="toc"/>
+	</list-block>
+      </xsl:if>
+    </flow>    
   </page-sequence>
-  <xsl:apply-templates select="poetry"/> 
+  <xsl:apply-templates select="poetry|section[poetry]"/> 
 </xsl:template>
 
-<xsl:template match="poetry">
-  <page-sequence master-reference="book-sequence">
-    <xsl:call-template name="static-content">
-      <xsl:with-param name="title">
-        <xsl:apply-templates select="docinfo/title"/>
-      </xsl:with-param>
-    </xsl:call-template>
-    <flow flow-name="xsl-region-body">
-      <xsl:apply-templates/>
-    </flow>
-  </page-sequence>
+<xsl:template match="section|poetry" mode="toc">
+  <list-item>
+    <xsl:call-template name="list-label"/>
+    <list-item-body start-indent="body-start()">
+      <xsl:apply-templates select="." mode="xref"/>
+      <!-- xsl:if test="poetry|section">
+	<list-block 
+	    text-indent="body-start()"
+	    space-before="15pt">
+	  <xsl:apply-templates select="poetry|section" mode="toc"/>
+	</list-block>
+      </xsl:if -->
+    </list-item-body>
+  </list-item>
 </xsl:template>
 
-<xsl:template match="section/title">
+<xsl:template match="section">
+  <xsl:variable name="id">
+    <xsl:call-template name="get-id"/>
+  </xsl:variable>
+  <block id="{$id}">
+    <xsl:apply-templates/>
+  </block>
+</xsl:template>
+
+<xsl:template match="preambule">
+  <xsl:variable name="id">
+    <xsl:call-template name="get-id"/>
+  </xsl:variable>
+  <block id="{$id}">
+    <xsl:if test="not(title)">
+      <block xsl:use-attribute-sets="verylarge-title-font">
+	<xsl:attribute name="space-after">5pt</xsl:attribute>
+	<xsl:attribute name="space-before">10pt</xsl:attribute>
+	<xsl:text>Préambule</xsl:text>
+      </block>
+    </xsl:if>
+    <xsl:apply-templates/>
+  </block>
+</xsl:template>
+
+<xsl:template match="book/title|section/title|preambule/title">
   <block xsl:use-attribute-sets="verylarge-title-font">
     <xsl:attribute name="space-after">5pt</xsl:attribute>
     <xsl:attribute name="space-before">10pt</xsl:attribute>
@@ -107,11 +169,11 @@
 </xsl:template>
 
 <xsl:template match="nda">
-  <block border-top="solid" border-bottom="solid"
-    font-size="75%" font-style="italic"
-    padding-top="10pt" padding-bottom="10pt"
-    space-before="1in" space-before.conditionnaly="discard"
-    margin-left=".5in" margin-right=".5in">
+  <block border="solid" padding="5mm"
+    font-size="90%" font-style="italic"
+    space-before="15mm" space-before.conditionnaly="discard"
+    space-after="15mm" space-after.conditionnaly="discard"
+    margin="5mm">
     <xsl:apply-templates/>
   </block>
 </xsl:template>
@@ -145,9 +207,6 @@
 
 <xsl:template match="poem">
   <block xsl:use-attribute-sets="standard-block">
-    <xsl:attribute name="id">
-      <xsl:value-of select="../@id"/>
-    </xsl:attribute>
     <xsl:apply-templates/>
   </block>
 </xsl:template>
@@ -177,13 +236,14 @@
   <xsl:apply-templates/>
 </xsl:template>
 
-<xsl:template match="poetry" mode="xref">
-  <xsl:variable name="href">
+<xsl:template match="poetry|section" mode="xref">
+  <xsl:variable name="id">
     <xsl:call-template name="get-id"/>
   </xsl:variable>
-  <basic-link internal-destination="{$href}">
-    <xsl:value-of select="docinfo/title"/>
-    (<page-number-citation ref-id="{$href}"/>)
+  <basic-link internal-destination="{$id}">
+    <xsl:value-of select="descendant::title[1]"/>
+    <leader leader-pattern="dots" leader-length.maximum="254mm"/>
+    (<page-number-citation ref-id="{$id}"/>)
   </basic-link>
 </xsl:template>