cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/slop/samples/yapt/stylesheets dir-to-html.xsl filter-slop-output.xsl heading.xsl html-index.xsl html-slides.xsl select-slide.xsl
Date Fri, 26 Sep 2003 14:42:36 GMT
bdelacretaz    2003/09/26 07:42:36

  Modified:    src/blocks/slop/conf slop.xsamples
               src/blocks/slop/samples sitemap.xmap
  Added:       src/blocks/slop/samples/yapt sitemap.xmap
               src/blocks/slop/samples/yapt/css yapt-images.css
                        yapt-style.css
               src/blocks/slop/samples/yapt/presentations yapt-demo.txt
               src/blocks/slop/samples/yapt/presentations/yapt-demo-images
                        screenshot.jpg tree.gif
               src/blocks/slop/samples/yapt/stylesheets dir-to-html.xsl
                        filter-slop-output.xsl heading.xsl html-index.xsl
                        html-slides.xsl select-slide.xsl
  Log:
  YAPT presentation tool sample added
  
  Revision  Changes    Path
  1.2       +5 -0      cocoon-2.1/src/blocks/slop/conf/slop.xsamples
  
  Index: slop.xsamples
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/slop/conf/slop.xsamples,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- slop.xsamples	6 Aug 2003 12:59:13 -0000	1.1
  +++ slop.xsamples	26 Sep 2003 14:42:36 -0000	1.2
  @@ -8,5 +8,10 @@
         (the Simple Line Oriented Parser)
         to parse text files
       </sample>
  +      <sample name="YAPT Presentation Tool" href="slop/yapt/">
  +        Yet Another Presentation Tool!
  +        Uses simple structured ASCII files to quickly create
  +        XML-based presentations
  +      </sample>
     </group>
   </xsamples>
  
  
  
  1.3       +5 -0      cocoon-2.1/src/blocks/slop/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/slop/samples/sitemap.xmap,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- sitemap.xmap	7 Aug 2003 08:07:06 -0000	1.2
  +++ sitemap.xmap	26 Sep 2003 14:42:36 -0000	1.3
  @@ -35,6 +35,11 @@
               <map:read mime-type="text/plain" src="{1}.txt"/>
           </map:match>
   
  +        <!-- more samples -->
  +        <map:match pattern="*/**">
  +           <map:mount check-reload="yes" src="{1}/" uri-prefix="{1}"/>
  +         </map:match>
  +
       </map:pipeline>
   
     </map:pipelines>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- sitemap for yapt - Yet Another Presentation Tool -->
  
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  
      <map:views>
          <map:view from-label="raw-content" name="raw-content">
              <map:serialize type="xml"/>
          </map:view>
          <map:view from-label="phase2" name="phase2">
              <map:serialize type="xml"/>
          </map:view>
          <map:view from-label="yapt-content" name="yapt-content">
              <map:serialize type="xml"/>
          </map:view>
  
      </map:views>
  
      <map:pipelines>
  
          <map:pipeline type="caching">
  
              <map:match pattern="">
                  <map:redirect-to uri="index"/>
              </map:match>
  
              <!-- CSS stylesheets, from common directory -->
              <map:match pattern="**/*.css">
                  <map:read src="css/{2}.css" mime-type="text/css"/>
              </map:match>
  
              <!-- images, from slides directory -->
              <map:match pattern="presentations/**/*.jpg">
                  <map:read src="presentations/{1}/{2}.jpg" mime-type="image/jpeg"/>
              </map:match>
              <map:match pattern="presentations/**/*.gif">
                  <map:read src="presentations/{1}/{2}.gif" mime-type="image/gif"/>
              </map:match>
  
              <!-- index of available presentations -->
              <map:match pattern="index">
                  <map:generate label="raw-content" type="directory" src="presentations"/>
                  <map:transform src="stylesheets/dir-to-html.xsl">
                      <map:parameter name="baseDir" value="presentations"/>
                  </map:transform>
                  <map:serialize type="html"/>
              </map:match>
  
              <!-- Raw ASCII data of a complete presentation -->
              <map:match pattern="presentations/**/txt/presentation">
                  <map:read src="presentations/{1}.txt" mime-type="text/plain"/>
              </map:match>
  
              <!-- XML data of a complete presentation -->
              <map:match pattern="presentations/**/xml/presentation">
                  <map:generate type="slop" src="presentations/{1}.txt">
                      <map:parameter name="encoding" value="iso-8859-1"/>
                  </map:generate>
                  <map:transform src="stylesheets/filter-slop-output.xsl"/>
                  <map:serialize type="xml"/>
              </map:match>
  
              <!-- XML data of a single slide -->
              <map:match pattern="presentations/**/xml/slide-*">
                  <map:generate src="cocoon:/presentations/{1}/xml/presentation"/>
                  <map:transform src="stylesheets/select-slide.xsl">
                      <map:parameter name="slideId" value="{2}"/>
                  </map:transform>
                  <map:serialize type="xml"/>
              </map:match>
  
              <!-- index (list of slides) of a presentation -->
              <map:match pattern="presentations/**/html/index">
                  <map:generate src="cocoon:/presentations/{1}/xml/presentation"/>
                  <map:transform src="stylesheets/html-index.xsl"/>
                  <map:serialize type="html"/>
              </map:match>
  
              <!-- single slide or full presentation in HTML -->
              <map:match pattern="presentations/**/html/*">
                  <map:generate src="cocoon:/presentations/{1}/xml/{2}"/>
                  <map:transform src="stylesheets/html-slides.xsl"/>
                  <map:serialize type="html"/>
              </map:match>
  
          </map:pipeline>
  
      </map:pipelines>
  
  </map:sitemap>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/css/yapt-images.css
  
  Index: yapt-images.css
  ===================================================================
  /**
      CSS stylesheet for yapt images
      based on ideas and tutorials from http://www.bigbaer.com
  
      $Id: yapt-images.css,v 1.1 2003/09/26 14:42:36 bdelacretaz Exp $
  */
  
  /** basic images stuff */
  img {border: 0;}
  
  /** allow an image to follow its DIV's size */
  img.scaledImage {
    width: 100%;
  }
  
  /** classes of images for position (left, right, top) and width */
  
  .fullWidth { float:top: width: 100%; }
  .leftThird { float: left; width: 33%; }
  .leftHalf { float: left; width: 50%;}
  .rightThird { float: right; width: 33%; }
  .rightHalf { float: right; width: 50%;}
  
  /** common stuff for images */
  div.leftThird,
  div.leftHalf,
  div.rightThird,
  div.rightHalf
  {
    border: thin silver solid;
    margin: 0.5em;
    padding: 0.5em;
    text-align: center
  }
  
  /** image caption if any */
  p.caption {
    font-style: italic;
    font-size: smaller;
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/css/yapt-style.css
  
  Index: yapt-style.css
  ===================================================================
  /**
      Main CSS stylesheet for yapt
      Main looks inspired from linotype CSS stylesheets
  */
  
  #content {
      font-family: "georgia", "times", "times new roman", serif;
      height:100%;
  }
  
  h1 {
      margin-bottom: 0;
      font-variant: small-caps;
      background: transparent;
      font-size: 150%;
  }
  
  h2 {
      margin-bottom: 0;
      background: transparent;
      font-size: 125%;
  }
  
  h3 {
      margin-bottom: 0;
      background: transparent;
  }
  
  .note {
      font-style: italic;
  }
  
  a {
  	text-decoration: none;
  	color: #000;
  	border-bottom: 1px dotted #777;
  	margin: 0px 2px 0px 2px;
  	padding: 1px 1px 1px 1px;
  }
  
  a:hover {
  	border: 1px dotted #000;
  	background-color: #eee;
  	padding: 1px 2px 1px 2px;
  	margin: 0px;
  }
  
  a:active {
  	background-color: #ccc !important;
  	position: relative;
  	top: 1px;
  	left: 1px;
  	padding: 1px 2px 1px 2px;
  	margin: 0px;
  }
  
  a:focus {
  	border: 1px solid #fff !important;
  	background-color: #ccc !important;
  	padding: 1px 2px 1px 2px;
  	margin: 0px;
  }
  
  /** slides index */
  #slidesList .slideId {
      display: inline;
      margin-left; 2em;
      width: 3em;
      text-align: right;
  }
  
  #presHeading .commentLine {
      font-style: italic;
      margin:0.2em;
  }
  
  #presHeading .fieldName {
      display: inline;
      font-weight: bold;
  }
  
  #presHeading .fieldValue {
      display: inline;
  }
  
  #slidesList .slideTitle {
      display: inline;
  }
  
  /** navigation at the bottom of slides */
  #navigation {
      position:fixed;
      bottom: 0;
  }
  
  #navigation div {
      display: inline;
  }
  
  #navigation a {
      font-size: 80%;
      color: grey;
  }
  
  /** style hints for slides */
  .slideHintLotsOfText {
      font-size: 80%;
  }
  .slideHintLittleText {
      font-size: 120%;
  }
  
  /** printing */
  @media print {
      #multipleSlides div.slide {
          page-break-after: avoid; page-break-inside: avoid;
      }
  
      img {
          page-break-inside: avoid;
      }
  
      h1, h2, h3, h4, h5, h6 {
          page-break-after: avoid; page-break-inside: avoid;
      }
  
      blockquote, pre {
          page-break-inside: avoid;
      }
  
      ul, ol, dl {
          page-break-before: avoid;
      }
  }
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/presentations/yapt-demo.txt
  
  Index: yapt-demo.txt
  ===================================================================
  presentation: YAPT demo
  image-directory: yapt-demo-images
  author: Bertrand Delacrétaz
  date: September 2003
  cvs: $Id: yapt-demo.txt,v 1.1 2003/09/26 14:42:36 bdelacretaz Exp $
  A (short) journey through the (few) YAPT features.
  
  slide: What is YAPT?
  hint-style: LotsOfText
  
  Yet Another Presentation Tool.
  
  The idea is to make it super-easy to create decent-looking presentations, for display or
printing.
  
  A presentation consists of a single structured (wiki-like) ASCII file, with some simple
rules:
  
  * The first line must contain "presentation:" (without quotes) followed by the presentation
title.
  
  * Each slide starts with a "slide:" line.
  
  * Empty lines separate paragraphs. There must be an empty line between the slide: line and
the slide text.
  
  * For images, use a single line starting with img_XXXX: where XXX is the CSS class
  name to use. See yapt-images.css for available classes.
  
  * A "presentation" page containing all slides is available for printing.
  
  * Presentations are converted in XML on the way.
  
  That's it. There are more details and examples in the following slides, and you can have
a look a the yapt-demo.txt
  file from which this presentation is created.
  
  slide: Navigation
  hint-style: LittleText
  
  Click anywhere on a slide to go to the next one.
  
  Use the grey links at the bottom of the page to go to the previous slide, or to the index.
  
  note: This page uses a hint-style line to indicate that it contains little text and can
use a larger font
  
  slide: Image examples: half-left image
  
  img_leftHalf: screenshot.jpg
  Here's a example with an image. Try zooming or resizing your browser to presentation sizes
to see how the display
  behaves, the image must stay on the left and take half the width of the screen or page.
  
  If you add text here it comes as a new paragraph.
  
  
  slide: Image examples: half-right image
  
  img_rightHalf: screenshot.jpg
  Here's about the same thing, only with the image on the right.
  
  subtitle: A subtitle
  At this size, we'd only add a small legend here.
  
  
  slide: Image examples: two images at 33%
  
  img_leftThird: screenshot.jpg
  Let's try with images on both the left and right sizes, how does this behave at
  different zoom settings?
  
  img_rightThird: tree.gif
  subtitle: Flow!
  When resizing, the text should flow freely between images.
  
  slide: Conclusions
  
  I'll try to use this tool for actual presentations in the near future, so it
  will certainly get some improvements.
  
  Missing features include:
  
  * Real bulleted lists (but according to some they are evil;-)
  
  * Code sections (monospaced fonts etc)
  
  * Presentation wizard to automatically generate complicated flashy layouts with lots of
stupid
  transitions. Just kidding.
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/presentations/yapt-demo-images/screenshot.jpg
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/presentations/yapt-demo-images/tree.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/stylesheets/dir-to-html.xsl
  
  Index: dir-to-html.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
      Simple listing of available yapt presentations
      $Id: dir-to-html.xsl,v 1.1 2003/09/26 14:42:36 bdelacretaz Exp $
  -->
  <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:dir="http://apache.org/cocoon/directory/2.0"
  >
  
      <xsl:param name="pageTitle" select="'Available YAPT presentations'"/>
      <xsl:param name="baseDir"/>
  
      <xsl:template match="/">
          <html>
              <head>
                  <title><xsl:value-of select="$pageTitle"/></title>
                  <link rel="stylesheet" type="text/css" href="css/yapt-style.css"/>
              </head>
              <body>
                  <div id="content">
                      <h1><xsl:value-of select="$pageTitle"/></h1>
                      <ul>
                          <xsl:apply-templates select="dir:directory/dir:file"/>
                      </ul>
                  </div>
              </body>
          </html>
  
      </xsl:template>
  
      <!-- link to presentation index and its source code -->
      <xsl:template match="dir:file">
          <xsl:variable name="presName" select="substring-before(@name,'.txt')"/>
          <xsl:if test="$presName">
              <li>
                  <a href="{concat($baseDir,'/',$presName,'/html/index')}">
                      <xsl:value-of select="$presName"/>
                  </a>
                  (
                  <a href="{concat($baseDir,'/',$presName,'/txt/presentation')}">
                      .txt source file
                  </a>
                  )
              </li>
          </xsl:if>
      </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/stylesheets/filter-slop-output.xsl
  
  Index: filter-slop-output.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
      Convert the slop parser output to a collection of slides
      $Id: filter-slop-output.xsl,v 1.1 2003/09/26 14:42:36 bdelacretaz Exp $
  -->
  <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:slop="http://apache.org/cocoon/slop/parser/1.0"
  >
  
      <!-- prefix for presentation hints in slides -->
      <xsl:variable name="hintPrefix" select="'hint-'"/>
  
      <!--
          Extract the presentation heading and let slides extract themselves,
          once to generate the navigation (list of slides) and once to
          generate content
      -->
      <xsl:template match="/">
          <yapt-presentation>
              <heading>
                  <!-- get everything up to the first slide -->
                  <xsl:apply-templates
                      mode="head"
                      select="slop:parsed-text/*[not(preceding::slop:slide) and not(self::slop:slide)]"
                  />
              </heading>
              <navigation>
                  <!-- extract all slides, without content -->
                  <xsl:apply-templates
                      mode="navigation"
                      select="slop:parsed-text/slop:slide"
                  />
              </navigation>
              <content>
                  <!-- extract slide elements, let them get their content -->
                  <xsl:apply-templates
                      mode="content"
                      select="slop:parsed-text/slop:slide"
                  />
              </content>
          </yapt-presentation>
      </xsl:template>
  
      <!-- head: by default copy everything, removing slop namespace -->
      <xsl:template match="*" mode="head">
          <xsl:element name="{name()}">
              <xsl:copy-of select="@*"/>
              <xsl:apply-templates/>
          </xsl:element>
      </xsl:template>
  
      <!-- head: eat empty lines and config stuff -->
      <xsl:template match="slop:empty-line" mode="head"/>
  
      <!-- navigation: output slide with unique id -->
      <xsl:template match="slop:slide" mode="navigation">
          <xsl:variable name="id">
              <xsl:number level="single" count="slop:slide"/>
          </xsl:variable>
          <slide-ref slide-id="{$id}" title="{.}"/>
      </xsl:template>
  
      <!-- content: output slide with unique id and content -->
      <xsl:template match="slop:slide" mode="content">
          <xsl:variable name="id">
              <xsl:number level="single" count="slop:slide"/>
          </xsl:variable>
  
          <slide slide-id="{$id}">
              <xsl:variable name="anchor" select="."/>
              <slide-head>
                  <title><xsl:value-of select="."/></title>
              </slide-head>
              <slide-hints>
                  <!-- collect presentation hints -->
                  <xsl:apply-templates mode="hints" select="following-sibling::slop:*[starts-with(name(),$hintPrefix)][preceding::slop:slide[1]
= $anchor]"/>
              </slide-hints>
              <slide-content>
                  <!-- recursively group paragraphs of this slide, separated by empty lines
-->
                  <!-- TODO can be made more efficient using keys -->
                  <xsl:for-each select="following-sibling::slop:empty-line[preceding::slop:slide[1]
= $anchor]">
                      <xsl:apply-templates select="." mode="paragraph"/>
                  </xsl:for-each>
              </slide-content>
          </slide>
      </xsl:template>
  
      <!-- presentation hints -->
      <xsl:template match="*[starts-with(name(),$hintPrefix)]" mode="hints">
          <xsl:element name="{substring-after(name(),$hintPrefix)}">
              <xsl:value-of select="."/>
          </xsl:element>
      </xsl:template>
  
      <!-- ignore hints in content -->
      <xsl:template match="*[starts-with(name(),$hintPrefix)]" mode="content"/>
  
      <!-- ignore multiple empty lines -->
      <xsl:template mode="paragraph" match="slop:empty-line[following-sibling::*[1][self::slop:empty-line]]"/>
  
      <!-- empty line separates paragraphs -->
      <xsl:template mode="paragraph" match="slop:empty-line">
          <p>
              <xsl:for-each select="following-sibling::*[1][not(self::slop:empty-line)
and not(self::slop:slide)]">
                  <xsl:call-template name="para-grouper"/>
              </xsl:for-each>
          </p>
      </xsl:template>
  
      <!-- recursively collect elements until an empty line or the next slide is found
-->
      <xsl:template name="para-grouper">
          <xsl:apply-templates mode="paragraph" select="."/>
  
          <xsl:for-each select="following-sibling::*[1][not(self::slop:empty-line) and
not(self::slop:slide)]">
              <xsl:call-template name="para-grouper"/>
          </xsl:for-each>
      </xsl:template>
  
      <!-- paragraph grouping mode, by default copy everything, removing slop namespace
-->
      <xsl:template match="slop:*" mode="paragraph">
          <xsl:element name="{name()}">
              <xsl:copy-of select="@*"/>
              <xsl:apply-templates/>
          </xsl:element>
      </xsl:template>
  
      <!-- extract the text of lines -->
      <xsl:template match="slop:line" mode="paragraph">
          <xsl:value-of select="concat(.,' ')"/>
      </xsl:template>
  
      <!-- images are defined like "img_XX: filename" where XX is the CSS class -->
      <xsl:template mode="paragraph" match="slop:*[starts-with(name(),'img')]">
            <xsl:variable name="class" select="substring-after(name(),'img_')"/>
              <img src="{.}" alt="{.}" class="{$class}"/>
        </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/stylesheets/heading.xsl
  
  Index: heading.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
      Templates for transforming presentation heading to HTML
      $Id: heading.xsl,v 1.1 2003/09/26 14:42:36 bdelacretaz Exp $
  -->
  <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  >
  
      <!-- presentation info: display field name + value -->
      <xsl:template mode="heading" match="*">
          <div class="headingField">
              <div class="fieldName">
                  <xsl:value-of select="concat(name(),':')"/>
              </div>
              <div class="fieldValue">
                  <xsl:value-of select="."/>
              </div>
          </div>
      </xsl:template>
  
      <!-- presentation info: comment lines -->
      <xsl:template mode="heading" match="line">
          <p class="commentLine">
              <xsl:value-of select="."/>
          </p>
      </xsl:template>
  
      <!-- presentation info: title -->
      <xsl:template mode="heading" match="presentation">
          <h1><xsl:value-of select="."/></h1>
      </xsl:template>
  
      <!-- omit some presentation fields -->
      <xsl:template mode="heading" match="image-directory"/>
  
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/stylesheets/html-index.xsl
  
  Index: html-index.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
      Generate HTML for the index of a presentation
      $Id: html-index.xsl,v 1.1 2003/09/26 14:42:36 bdelacretaz Exp $
  -->
  <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  >
      <!-- heading templates -->
      <xsl:import href="heading.xsl"/>
  
      <xsl:variable name="pageTitle" select="/yapt-presentation/heading/presentation"/>
  
      <!-- output the presentation heading and the list of slides -->
      <xsl:template match="/">
          <html>
              <head>
                  <title><xsl:value-of select="$pageTitle"/></title>
                  <link rel="stylesheet" type="text/css" href="css/yapt-style.css"/>
              </head>
              <body>
                  <div id="content">
                      <div id="presHeading">
                          <xsl:apply-templates mode="heading" select="yapt-presentation/heading/*"/>
                      </div>
                      <div id="indexContents">
                          <div id="slidesList">
                              <h2>Slides</h2>
                              <xsl:apply-templates mode="navigation" select="yapt-presentation/navigation"/>
                              <h3>All slides in a single page</h3>
                              <div class="slideListItem">
                                  <div class="slideId">
                                      -
                                  </div>
                                  <div class="slideTitle">
                                      <a href="presentation">presentation</a>
                                  </div>
                              </div>
                          </div>
                      </div>
                  </div>
              </body>
          </html>
      </xsl:template>
  
      <!-- navigation links -->
      <xsl:template match="slide-ref" mode="navigation">
          <div class="slideListItem">
              <div class="slideId">
                  <xsl:value-of select="@slide-id"/>.
              </div>
              <div class="slideTitle">
                  <a href="{concat('slide-',@slide-id)}">
                      <xsl:value-of select="@title"/>
                  </a>
              </div>
          </div>
      </xsl:template>
  
  
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/stylesheets/html-slides.xsl
  
  Index: html-slides.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
      Generate the HTML for one or many slides
      $Id: html-slides.xsl,v 1.1 2003/09/26 14:42:36 bdelacretaz Exp $
  -->
  <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  >
      <!-- heading templates -->
      <xsl:import href="heading.xsl"/>
  
      <!-- path to images -->
      <xsl:variable name="imagePath" select="concat('../../',/yapt-presentation/heading/image-directory,'/')"/>
  
      <!-- single or multi-slide display? -->
      <xsl:variable name="slideCount" select="count(/yapt-presentation/content/slide)"/>
  
      <!-- setup CSS stylesheets, javascript for "next slide" click and output content
-->
      <xsl:template match="/">
          <html>
              <head>
                  <link rel="stylesheet" type="text/css" href="css/yapt-style.css"/>
                  <link rel="stylesheet" type="text/css" href="css/yapt-images.css"/>
              </head>
              <body>
                  <xsl:if test="$slideCount &lt; 2">
                      <!-- single slide: click body to go to next slide -->
                      <xsl:variable name="nextId" select="//navigation/slide-ref[@offset-from-current=1]/@slide-id"/>
                      <xsl:if test="$nextId">
                          <xsl:attribute name="onClick">document.location='slide-<xsl:value-of
select="$nextId"/>'</xsl:attribute>
                      </xsl:if>
                  </xsl:if>
  
                  <div id="content">
                      <div id="slides-page">
                          <xsl:apply-templates select="yapt-presentation"/>
                      </div>
                  </div>
              </body>
          </html>
      </xsl:template>
  
      <xsl:template match="yapt-presentation">
  
          <!-- if multiple slides, output presentation heading -->
          <xsl:if test="$slideCount &gt; 1">
              <div id="presHeading">
                  <xsl:apply-templates select="heading/*" mode="heading"/>
              </div>
          </xsl:if>
  
          <!-- output slides -->
          <div id="slides">
              <xsl:apply-templates mode="content" select="content/slide"/>
          </div>
  
          <!-- for single slide, output navigation -->
          <xsl:if test="$slideCount &lt; 2">
              <div id="navigation">
                  <xsl:apply-templates select="navigation" mode="navigation"/>
              </div>
          </xsl:if>
  
      </xsl:template>
  
      <!-- navigation: link to previous slide, table of contents and next slide -->
      <xsl:template match="navigation" mode="navigation">
          <xsl:variable name="prev" select="slide-ref[@offset-from-current = -1]/@slide-id"/>
          <xsl:variable name="next" select="slide-ref[@offset-from-current = 1]/@slide-id"/>
  
          <xsl:if test="$prev">
              <div class="navItem">
                  <a href="{concat('slide-',$prev)}">
                      previous
                  </a>
              </div>
          </xsl:if>
  
          <div class="navItem">
              <a href="index">
                  index
              </a>
          </div>
  
          <xsl:if test="$next">
              <div class="navItem">
                  <a href="{concat('slide-',$next)}">
                      next
                  </a>
              </div>
          </xsl:if>
  
      </xsl:template>
  
      <!-- in content, float images according to their CSS classes -->
      <xsl:template mode="content" match="img">
          <div class="{@class}">
              <img src="{concat($imagePath,@src)}" alt="{@alt}" class="scaledImage"/>
          </div>
      </xsl:template>
  
      <!-- subtitle in content -->
      <xsl:template mode="content" match="subtitle">
          <h2><xsl:value-of select="."/></h2>
      </xsl:template>
  
      <!-- note in content -->
      <xsl:template mode="content" match="note">
          <p class="note">
              <xsl:value-of select="."/>
          </p>
      </xsl:template>
  
      <!-- slide in content -->
      <xsl:template mode="content" match="slide">
          <div class="singleSlide">
              <div class="singleSlideHeading">
                  <xsl:apply-templates mode="content" select="slide-head/*"/>
              </div>
              <!-- use style hints if any -->
              <div class="{concat('slideHint',slide-hints/style)}">
                  <div class="singleSlideContent">
                      <xsl:apply-templates mode="content" select="slide-content/*"/>
                  </div>
              </div>
          </div>
      </xsl:template>
  
      <!-- slide title in content -->
      <xsl:template mode="content" match="title">
          <h1>
              <xsl:value-of select="ancestor::slide/@slide-id"/>.
              <xsl:value-of select="."/>
          </h1>
      </xsl:template>
  
      <!-- copy other content elements -->
      <xsl:template mode="content" match="*" priority="-1">
          <xsl:element name="{name()}">
              <xsl:copy-of select="@*"/>
              <xsl:apply-templates mode="content"/>
          </xsl:element>
      </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slop/samples/yapt/stylesheets/select-slide.xsl
  
  Index: select-slide.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
      Select a single slide from the output of filter-slop-output.xsl
      $Id: select-slide.xsl,v 1.1 2003/09/26 14:42:36 bdelacretaz Exp $
  -->
  <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  >
  
      <!-- which slide to select -->
      <xsl:param name="slideId"/>
  
      <!-- By default copy everything -->
      <xsl:template match="*">
          <xsl:copy>
              <xsl:copy-of select="@*"/>
              <xsl:apply-templates/>
          </xsl:copy>
      </xsl:template>
  
      <!-- add position attributes for next/previous navigation -->
      <xsl:template match="slide-ref">
          <xsl:copy>
              <xsl:copy-of select="@*"/>
  
              <xsl:attribute name="offset-from-current">
                  <xsl:value-of select="@slide-id - $slideId"/>
              </xsl:attribute>
  
              <xsl:apply-templates/>
          </xsl:copy>
      </xsl:template>
  
      <!-- omit slides, except for the selected one -->
      <xsl:template match="slide[not(@slide-id = $slideId)]"/>
  
  </xsl:stylesheet>
  
  
  

Mime
View raw message