story_print.xsl
author Fabien Ninoles <fabien@tzone.org>
Mon, 14 Sep 2015 11:24:14 -0400
branchstyles
changeset 15 27a2a404231e
parent 10 5bba8548413e
permissions -rw-r--r--
More support for link.

<?xml version="1.0"?>
<xsl:stylesheet version="1.1"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xt="http://www.jclark.com/xt"
  extension-element-prefixes="xt" 
  xmlns="http://www.w3.org/1999/XSL/Format">

<xsl:import href="common.xsl"/>
<xsl:import href="print.xsl"/>
<xsl:import href="masters_print.xsl"/>

<xsl:output method="xml" indent="yes"/>

<xsl:attribute-set name="standard-block">
  <xsl:attribute name="text-indent">10mm</xsl:attribute>
  <xsl:attribute name="space-before">10pt</xsl:attribute>
  <xsl:attribute name="space-before.conditionality">discard</xsl:attribute>
  <xsl:attribute name="text-align">justify</xsl:attribute>
</xsl:attribute-set>

<xsl:template name="static-content">
  <xsl:param name="title"/>
  <static-content flow-name="xsl-region-before">
    <block border-after-style="solid">
      <table width="100%" table-layout="fixed">
            <table-column column-width="proportional-column-width(1)"
                  number-columns-repeated="2"/>
            <table-body>
              <table-row>
                <table-cell>
                  <block text-align="start"><xsl:value-of select="$title"/></block>
                </table-cell>
              </table-row>
            </table-body>
          </table>
        </block>
      </static-content>
      <static-content flow-name="xsl-region-after">
        <block border-before-style="solid">
          <table width="100%" table-layout="fixed">
            <table-column column-width="proportional-column-width(1)"
                  number-columns-repeated="2"/>
            <table-body>
              <table-row>
                <table-cell>
                  <block text-align="end">
		    <xsl:text>page </xsl:text>
                    <page-number/>
                  </block>
                </table-cell>
              </table-row>
            </table-body>
          </table>
        </block>
      </static-content>
</xsl:template>

<!-- book -->
<xsl:template match="book">
  <root>
    <xsl:call-template name="master-set"/>
    <xsl:apply-templates select="section"/>
  </root>
</xsl:template>

<xsl:template match="/book/section|/book/preamble|/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:with-param>
    </xsl:call-template>
    <flow flow-name="xsl-region-body">
      <xsl:apply-templates select="*[name()!='story']"/>
    </flow>
  </page-sequence>
  <xsl:apply-templates select="story"/> 
</xsl:template>

<xsl:template match="story">
  <page-sequence master-reference="book-sequence">
    <xsl:call-template name="static-content">
      <xsl:with-param name="title">
        <xsl:apply-templates select="title"/>
      </xsl:with-param>
    </xsl:call-template>
    <flow flow-name="xsl-region-body">
      <xsl:apply-templates/>
    </flow>
  </page-sequence>
</xsl:template>

<xsl:template match="section/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:apply-templates/>
  </block>
</xsl:template>

<xsl:template match="story/title">
  <block xsl:use-attribute-sets="large-title-font">
    <xsl:attribute name="space-after">5pt</xsl:attribute>
    <xsl:attribute name="space-before">10pt</xsl:attribute>
    <xsl:apply-templates/>
  </block>
</xsl:template>

<xsl:template match="story/section/title">
  <block xsl:use-attribute-sets="medium-title-font">
    <xsl:attribute name="space-after">5pt</xsl:attribute>
    <xsl:attribute name="space-before">10pt</xsl:attribute>
    <xsl:apply-templates/>
  </block>
</xsl:template>

<xsl:template match="nda">
  <block border="solid" padding="5pt" font-style="italic">
    <xsl:apply-templates/>
  </block>
</xsl:template>

<xsl:template match="para">
  <block xsl:use-attribute-sets="standard-block">
    <xsl:apply-templates/>
  </block>
</xsl:template>

<!-- dialog template -->
<xsl:template match="dialog">
  <block xsl:use-attribute-sets="standard-block"
	 margin-left=".5in" margin-right=".5in">
    <xsl:apply-templates/>
  </block>
</xsl:template>
<xsl:template match="cite">
  <block xsl:use-attribute-sets="standard-block"
	 font-style="italic">
    <xsl:text>"</xsl:text>
    <xsl:apply-templates/>
    <xsl:text>"</xsl:text>
  </block>
</xsl:template>

<xsl:template match="citation">
  <block xsl:use-attribute-sets="standard-block" font-style="italic"
         font-size="90%" margin-left="4in">
    <xsl:apply-templates/>
  </block>
</xsl:template>

<xsl:template match="poem">
  <block xsl:use-attribute-sets="standard-block" font-style="italic"
     margin-left=".5in" margin-right=".5in">
    <xsl:apply-templates/>
  </block>
</xsl:template>

<xsl:template match="strophe">
  <block xsl:use-attribute-sets="standard-block">
    <xsl:apply-templates/>
  </block>
</xsl:template>

<xsl:template match="verse">
  <block><xsl:apply-templates/></block>
</xsl:template>

</xsl:stylesheet>