You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2005/06/17 11:53:34 UTC

[DAISY] Created: document-to-daisyhtml

A new document has been created.

http://cocoon.zones.apache.org/daisy/legacydocs/657

Document ID: 657
Branch: main
Language: default
Name: document-to-daisyhtml
Document Type: Attachment
Created: 6/17/05 9:53:19 AM
Creator (owner): Bruno Dumon
State: publish

Parts
=====

Attachment Data
---------------
Mime type: text/xml
Size: 2904 bytes
Content:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <xsl:apply-templates select="document/body"/>
  </xsl:template>

  <xsl:template match="document/body">
    <html>
      <body>
        <xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="handleAnchor">
    <xsl:choose>
      <xsl:when test="local-name(*[1]) = 'anchor'">
        <xsl:attribute name="id"><xsl:value-of select="*[1]/@id"/></xsl:attribute>
      </xsl:when>
      <xsl:when test="local-name(preceding-sibling::*[1]) = 'anchor'">
        <xsl:attribute name="id"><xsl:value-of select="preceding-sibling::*[1]/@id"/></xsl:attribute>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="s1">
    <h1>
      <xsl:call-template name="handleAnchor"/>
      <xsl:value-of select="@title"/>
    </h1>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="s2">
    <h2>
      <xsl:call-template name="handleAnchor"/>
      <xsl:value-of select="@title"/>
    </h2>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="s3">
    <h3>
      <xsl:call-template name="handleAnchor"/>
      <xsl:value-of select="@title"/>
    </h3>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="s4">
    <h4>
      <xsl:call-template name="handleAnchor"/>
      <xsl:value-of select="@title"/>
    </h4>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="sl">
    <ul><xsl:apply-templates/></ul>
  </xsl:template>

  <xsl:template match="link|connect|jump|fork">
    <a><xsl:copy-of select="@*"/><xsl:apply-templates/></a>
  </xsl:template>

  <xsl:template match="figure">
    <p align="center"><img><xsl:copy-of select="@*"/><xsl:apply-templates/></img></p>
  </xsl:template>

  <xsl:template match="source">
    <pre><xsl:apply-templates/></pre>
  </xsl:template>
  
  <xsl:template match="note">
    <p class="note"><xsl:apply-templates/></p>
  </xsl:template>

  <xsl:template match="fixme">
    <p class="fixme"><xsl:apply-templates/></p>
  </xsl:template>

  <xsl:template match="code">
    <tt><xsl:apply-templates/></tt>
  </xsl:template>

  <xsl:template match="table">
    <xsl:if test="caption">
      <p>
        <xsl:apply-templates select="caption/node()"/>
      </p>
    </xsl:if>
    <table>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates select="tr"/>
    </table>
  </xsl:template>

  <xsl:template match="dl">
    <ul>
      <xsl:for-each select="dt">
        <li>
          <xsl:apply-templates select="./node()"/>
          <xsl:text>: </xsl:text>
          <xsl:apply-templates select="following-sibling::dd[1]/node()"/>
        </li>
      </xsl:for-each>
    </ul>
  </xsl:template>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>


Collections
===========
The document belongs to the following collections: legacydocs