DocBook2Operashow

This customization layer for the DocBookXslStylesheets converts a DocBook document to html that can be viewed as a slide show in the Opera web browser.

Usage

When writing a DocBook document, use role="screen" to indicate elements that should only be displayed when viewing the page as regular html. This text diappears when viewing the page in full screen mode. Use role="presentation" on elements that should not appear when the page is viewed as regular html. Convert your DocBook document to html using the stylesheet below and your favorite xsl processor. Then view the page in Opera and press F11 to toggle full screen mode. For an example, see How to avoid learning XML. Also see this Operashow tutorial. Send questions to DavidCramer

Stylesheet

<?xml version="1.0" encoding="US-ASCII"?>

<!-- This DocBook customization layer allows you to produce -->
<!-- an Operashow presentation. For more information about -->
<!-- Operashow, see http://www.opera.com/support/tutorials/operashow -->
<!-- from DocBook using the html XSLs. Add role="screen" to -->
<!-- any element that you want to appear ONLY when viewed as -->
<!-- regular html. Use role="projection" on elements that -->
<!-- should appear ONLY in full screen mode. Currently it -->
<!-- supports role="screen" or role="projection" on block -->
<!-- level elements  -->

<!-- It's up to you to make sure that the text fits on the display at the -->
<!-- desired resolution. Currently, long slides end up -->
<!-- overlapping the next slide. I've been meaning to look -->
<!-- into seeing if there's a way to make it behave better -->
<!-- when this happens. -->

<!-- Send questions to david A T thingbag D O T net -->

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">

  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>

  <xsl:param name="css.decoration">1</xsl:param>
  <xsl:param name="generate.toc"></xsl:param>
  <xsl:param name="section.autolabel">0</xsl:param>

  <!-- Need this to be sure role="screen" is propagated to
  span around phrases -->
  <xsl:param name="phrase.propagates.style">1</xsl:param>

  <xsl:template match="*[not(self::phrase) and @role = 'screen']">
<div class="screen">
  <xsl:apply-imports/>
</div>
  </xsl:template>

  <xsl:template match="*[@role = 'projection']">
<div class="projection">
  <xsl:apply-imports/>
</div>
  </xsl:template>

  <xsl:template name="user.head.content">
<style type="text/css">
  /* common settings for all modes and CSS1 browsers */

  div.projection { display: none }
  div.screen { display: block }
  /* settings for normal screen mode */
  @media screen {
  body {
  color: black;
  background: white;
  margin: 2em;
  }

  div.projection { display: none }
  div.screen { display: block }

  }

  /* settings for projection mode */

  @media projection {
  body {
  font: 25px Gill Sans, sans-serif;
  color: black;
  background: white;
  padding-left: 1em;
  padding-right: 1em;
  }

  h1.title, h2.title, h3.title, h4.title, h5.title, h6.title, h7.title, h8.title { 
  page-break-before: always;
  font-size: 1.4em;
  text-align: center;

  margin-top: 2em;
  padding-bottom: 0.2em;

  }

  h1.title{
  page-break-before: auto;
  }

  // Don't display footnotes or footnote markers.
  // but do display superscripted numbers that aren't 
  // footnote markers. See override of inline.superscriptseq below.
  // This kind of works, but Opera gets a little confused by the 
      // inline non-displayed stuff inside a block non-displayed region.
  div.footnotes{  display: none;} 
  div.footnote{  display: none;} 
  sup.inline{display: inline;}
  sup{ display: none;}

  div.projection { display: block }
  div.screen { display: none }
      span.screen { display: none}

  }

  div.revhistory {padding-bottom: 6px}
  body { padding-top: 1px } /* hack to get around bug in Opera 4.0 */

</style>
  </xsl:template>

  <xsl:template name="user.header.content">
<div class="projection">
  <div class="logo">
<img src="http://docbook.sourceforge.net/release/buttons/docbook-1.png" 
  style="position: fixed; 
  bottom: 1em;
  right: 1em;"/>
  </div>
</div>
  <div class="screen">
<a href="http://docbook.sourceforge.net"><img src="http://docbook.sourceforge.net/release/buttons/docbook-1.png"/></a>
  </div>
  </xsl:template>

  <xsl:template name="inline.superscriptseq">
<xsl:param name="content">
  <xsl:call-template name="anchor"/>
  <xsl:call-template name="simple.xlink">
<xsl:with-param name="content">
  <xsl:apply-templates/>
</xsl:with-param>
  </xsl:call-template>
</xsl:param>
<sup class="inline"><xsl:copy-of select="$content"/></sup>
  </xsl:template>

</xsl:stylesheet>

DocBook2OperashowCustomizationLayer (last edited 2011-03-17 13:06:48 by NormanWalsh)