W3C home > Mailing lists > Public > public-html-commits@w3.org > May 2009

html5/markup/tools chunker.xsl,NONE,1.1

From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 01 May 2009 09:26:13 +0000
To: public-html-commits@w3.org
Message-Id: <E1Lzp0X-0001L6-7T@lionel-hutz.w3.org>
Update of /sources/public/html5/markup/tools
In directory hutz:/tmp/cvs-serv5134/tools

Added Files:
	chunker.xsl 
Log Message:
added chunker


--- NEW FILE: chunker.xsl ---
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
                xmlns:h='http://www.w3.org/1999/xhtml'
                xmlns='http://www.w3.org/1999/xhtml'
                xmlns:date="http://exslt.org/dates-and-times"
                xmlns:exsl="http://exslt.org/common"
                exclude-result-prefixes='h date'
                extension-element-prefixes="exsl"
                version='1.0' id='xslt'>

  <!-- * This stylesheet is based on code from stylesheets in the DocBook -->
  <!-- * XSL Stylesheets distribution; for details, see the -->
  <!-- * "Acknowledgements" comment at the end of this file. -->

  <xsl:template name="write.chunk">
    <xsl:param name="filename" select="''"/>
    <xsl:param name="quiet" select="0"/>
    <xsl:param name="method">html</xsl:param>
    <xsl:param name="encoding">us-ascii</xsl:param>
    <xsl:param name="media-type">text/html; charset=us-ascii</xsl:param>
    <xsl:param name="doctype-public">-//W3C//DTD HTML 4.01//EN</xsl:param>
    <xsl:param name="doctype-system">http://www.w3.org/TR/html4/strict.dtd</xsl:param>
    <xsl:param name="indent">yes</xsl:param>
    <xsl:param name="omit-xml-declaration">yes</xsl:param>
    <xsl:param name="cdata-section-elements"></xsl:param>
    <xsl:param name="content"/>
    <xsl:param name="title"/>
    <xsl:if test="$quiet = 0">
      <xsl:message>
        <xsl:text>Writing </xsl:text>
        <xsl:value-of select="$filename"/>
        <xsl:text> for "</xsl:text>
        <xsl:value-of select="$title"/>
        <xsl:text>"</xsl:text>
      </xsl:message>
    </xsl:if>
    <exsl:document href="{$filename}"
      method="{$method}"
      encoding="{$encoding}"
      indent="{$indent}"
      omit-xml-declaration="{$omit-xml-declaration}"
      cdata-section-elements="{$cdata-section-elements}"
      media-type="{$media-type}"
      doctype-public="{$doctype-public}"
      doctype-system="{$doctype-system}"
      >
      <xsl:call-template name="build.chunk">
        <xsl:with-param name="content" select="$content"/>
        <xsl:with-param name="title" select="$title"/>
      </xsl:call-template>
    </exsl:document>
  </xsl:template>
  <xsl:template name="build.chunk">
    <xsl:param name="title"/>
    <xsl:param name="prev"/>
    <xsl:param name="next"/>
    <xsl:param name="nav.context"/>
    <xsl:param name="content">
      <xsl:apply-imports/>
    </xsl:param>
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>
          <xsl:value-of select="$title"/>
        </title>
        <xsl:copy-of select="//h:link[@rel='stylesheet']"/>
        <!-- * <xsl:call-template name="head.nav.links"> -->
          <!-- * <xsl:with-param name="title" select="$title"/> -->
          <!-- * <xsl:with-param name="prev" select="$prev"/> -->
          <!-- * <xsl:with-param name="next" select="$next"/> -->
        <!-- * </xsl:call-template> -->
      </head>
      <body>
        <!-- * <xsl:call-template name="header.navigation"> -->
          <!-- * <xsl:with-param name="prev" select="$prev"/> -->
          <!-- * <xsl:with-param name="next" select="$next"/> -->
          <!-- * <xsl:with-param name="nav.context" select="$nav.context"/> -->
        <!-- * </xsl:call-template> -->
        <xsl:copy-of select="$content"/>
        <!-- * <xsl:call-template name="footer.navigation"> -->
          <!-- * <xsl:with-param name="prev" select="$prev"/> -->
          <!-- * <xsl:with-param name="next" select="$next"/> -->
          <!-- * <xsl:with-param name="nav.context" select="$nav.context"/> -->
        <!-- * </xsl:call-template> -->
      </body>
    </html>
  </xsl:template>
  <xsl:template name="head.navs.links">
    <xsl:param name="title"/>
    <xsl:param name="prev" select="/foo"/>
    <xsl:param name="next" select="/foo"/>
    <xsl:variable name="this" select="."/>
    <xsl:variable name="home" select="/*[1]"/>
    <xsl:variable name="up" select="parent::*"/>
    <xsl:if test="$home">
      <link rel="home">
        <xsl:attribute name="href">
          <!-- * <xsl:call-template name="href.target"> -->
            <!-- * <xsl:with-param name="object" select="$home"/> -->
            <!-- * </xsl:call-template> -->
        </xsl:attribute>
        <xsl:attribute name="title">
          <xsl:apply-templates select="$home"
            mode="object.title.markup.textonly"/>
        </xsl:attribute>
      </link>
    </xsl:if>

    <xsl:if test="$up">
      <link rel="up">
        <xsl:attribute name="href">
          <!-- * <xsl:call-template name="href.target"> -->
            <!-- * <xsl:with-param name="object" select="$up"/> -->
            <!-- * </xsl:call-template> -->
        </xsl:attribute>
        <xsl:attribute name="title">
          <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
        </xsl:attribute>
      </link>
    </xsl:if>

    <xsl:if test="$prev">
      <link rel="prev">
        <xsl:attribute name="href">
          <!-- * <xsl:call-template name="href.target"> -->
            <!-- * <xsl:with-param name="object" select="$prev"/> -->
            <!-- * </xsl:call-template> -->
        </xsl:attribute>
        <xsl:attribute name="title">
          <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
        </xsl:attribute>
      </link>
    </xsl:if>

    <xsl:if test="$next">
      <link rel="next">
        <xsl:attribute name="href">
          <!-- * <xsl:call-template name="href.target"> -->
            <!-- * <xsl:with-param name="object" select="$next"/> -->
            <!-- * </xsl:call-template> -->
        </xsl:attribute>
        <xsl:attribute name="title">
          <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
        </xsl:attribute>
      </link>
    </xsl:if>

    <xsl:for-each select="//part
      |//reference
      |//preface
      |//chapter
      |//article
      |//refentry
      |//appendix[not(parent::article)]|appendix
      |//glossary[not(parent::article)]|glossary
      |//index[not(parent::article)]|index">
      <link rel="{local-name(.)}">
        <xsl:attribute name="href">
          <!-- * <xsl:call-template name="href.target"> -->
            <!-- * <xsl:with-param name="context" select="$this"/> -->
            <!-- * <xsl:with-param name="object" select="."/> -->
            <!-- * </xsl:call-template> -->
        </xsl:attribute>
        <xsl:attribute name="title">
          <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
        </xsl:attribute>
      </link>
    </xsl:for-each>

    <xsl:for-each select="section|sect1|refsection|refsect1">
      <link>
        <xsl:attribute name="rel">
          <xsl:choose>
            <xsl:when test="local-name($this) = 'section'
              or local-name($this) = 'refsection'">
              <xsl:value-of select="'subsection'"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="'section'"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:attribute>
        <xsl:attribute name="href">
          <!-- * <xsl:call-template name="href.target"> -->
            <!-- * <xsl:with-param name="context" select="$this"/> -->
            <!-- * <xsl:with-param name="object" select="."/> -->
            <!-- * </xsl:call-template> -->
        </xsl:attribute>
        <xsl:attribute name="title">
          <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
        </xsl:attribute>
      </link>
    </xsl:for-each>

    <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
      <link rel="subsection">
        <xsl:attribute name="href">
          <!-- * <xsl:call-template name="href.target"> -->
            <!-- * <xsl:with-param name="context" select="$this"/> -->
            <!-- * <xsl:with-param name="object" select="."/> -->
            <!-- * </xsl:call-template> -->
        </xsl:attribute>
        <xsl:attribute name="title">
          <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
        </xsl:attribute>
      </link>
    </xsl:for-each>
  </xsl:template>
  <xsl:template name="header.navigation">
    <xsl:param name="prev" select="preceding-sibling::*"/>
    <xsl:param name="next" select="following-sibling::*"/>
    <xsl:param name="nav.context"/>
    <xsl:variable name="home" select="/*[1]"/>
    <xsl:variable name="up" select="parent::*"/>
    <xsl:variable name="row1" select="1"/>
    <xsl:variable name="row2" select="1"/>
    <!-- * <xsl:variable name="row2" select="count($prev) &gt; 0 -->
      <!-- * or (count($up) &gt; 0  -->
      <!-- * and generate-id($up) != generate-id($home)) -->
      <!-- * or count($next) &gt; 0"/> -->
      <div class="navheader">
        <xsl:if test="$row1 or $row2">
          <table width="100%" summary="Navigation header">
            <xsl:if test="$row1">
              <tr>
                <th colspan="3" align="center">
                  <xsl:apply-templates select="." mode="object.title.markup"/>
                </th>
              </tr>
            </xsl:if>

            <xsl:if test="$row2">
              <tr>
                <td width="20%" align="left">
                  <xsl:if test="count($prev)>0">
                    <a accesskey="p">
                      <xsl:attribute name="href">
                        <xsl:call-template name="href.target">
                          <xsl:with-param name="object" select="$prev"/>
                        </xsl:call-template>
                      </xsl:attribute>
                      <xsl:call-template name="navig.content">
                        <xsl:with-param name="direction" select="'prev'"/>
                      </xsl:call-template>
                    </a>
                  </xsl:if>
                  <xsl:text>&#160;</xsl:text>
                </td>
                <th width="60%" align="center">
                  <xsl:choose>
                    <xsl:when test="count($up) > 0
                      and generate-id($up) != generate-id($home)
                      and $navig.showtitles != 0">
                      <xsl:apply-templates select="$up" mode="object.title.markup"/>
                    </xsl:when>
                    <xsl:otherwise>&#160;</xsl:otherwise>
                  </xsl:choose>
                </th>
                <td width="20%" align="{$direction.align.end}">
                  <xsl:text>&#160;</xsl:text>
                  <xsl:if test="count($next)>0">
                    <a accesskey="n">
                      <xsl:attribute name="href">
                        <xsl:call-template name="href.target">
                          <xsl:with-param name="object" select="$next"/>
                        </xsl:call-template>
                      </xsl:attribute>
                      <xsl:call-template name="navig.content">
                        <xsl:with-param name="direction" select="'next'"/>
                      </xsl:call-template>
                    </a>
                  </xsl:if>
                </td>
              </tr>
            </xsl:if>
          </table>
        </xsl:if>
        <hr/>
      </div>
  </xsl:template>
  <xsl:template name="footer.navigation">
    <xsl:param name="prev" select="/foo"/>
    <xsl:param name="next" select="/foo"/>
    <xsl:param name="nav.context"/>
    <xsl:variable name="home" select="/*[1]"/>
    <xsl:variable name="up" select="parent::*"/>
    <xsl:variable name="row1" select="count($prev) &gt; 0
      or count($up) &gt; 0
      or count($next) &gt; 0"/>
    <xsl:variable name="row2" select="($prev and $navig.showtitles != 0)
      or (generate-id($home) != generate-id(.)
      or $nav.context = 'toc')
      or ($chunk.tocs.and.lots != 0
      and $nav.context != 'toc')
      or ($next and $navig.showtitles != 0)"/>
    <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
      <div class="navfooter">
        <xsl:if test="$footer.rule != 0">
          <hr/>
        </xsl:if>

        <xsl:if test="$row1 or $row2">
          <table width="100%" summary="Navigation footer">
            <xsl:if test="$row1">
              <tr>
                <td width="40%" align="left">
                  <xsl:if test="count($prev)>0">
                    <a accesskey="p">
                      <xsl:attribute name="href">
                        <xsl:call-template name="href.target">
                          <xsl:with-param name="object" select="$prev"/>
                        </xsl:call-template>
                      </xsl:attribute>
                      <xsl:call-template name="navig.content">
                        <xsl:with-param name="direction" select="'prev'"/>
                      </xsl:call-template>
                    </a>
                  </xsl:if>
                  <xsl:text>&#160;</xsl:text>
                </td>
                <td width="20%" align="center">
                  <xsl:choose>
                    <xsl:when test="count($up)&gt;0
                      and generate-id($up) != generate-id($home)">
                      <a accesskey="u">
                        <xsl:attribute name="href">
                          <xsl:call-template name="href.target">
                            <xsl:with-param name="object" select="$up"/>
                          </xsl:call-template>
                        </xsl:attribute>
                        <xsl:call-template name="navig.content">
                          <xsl:with-param name="direction" select="'up'"/>
                        </xsl:call-template>
                      </a>
                    </xsl:when>
                    <xsl:otherwise>&#160;</xsl:otherwise>
                  </xsl:choose>
                </td>
                <td width="40%" align="{$direction.align.end}">
                  <xsl:text>&#160;</xsl:text>
                  <xsl:if test="count($next)>0">
                    <a accesskey="n">
                      <xsl:attribute name="href">
                        <xsl:call-template name="href.target">
                          <xsl:with-param name="object" select="$next"/>
                        </xsl:call-template>
                      </xsl:attribute>
                      <xsl:call-template name="navig.content">
                        <xsl:with-param name="direction" select="'next'"/>
                      </xsl:call-template>
                    </a>
                  </xsl:if>
                </td>
              </tr>
            </xsl:if>

            <xsl:if test="$row2">
              <tr>
                <td width="40%" align="left" valign="top">
                  <xsl:if test="$navig.showtitles != 0">
                    <xsl:apply-templates select="$prev" mode="object.title.markup"/>
                  </xsl:if>
                  <xsl:text>&#160;</xsl:text>
                </td>
                <td width="20%" align="center">
                  <xsl:choose>
                    <xsl:when test="$home != . or $nav.context = 'toc'">
                      <a accesskey="h">
                        <xsl:attribute name="href">
                          <xsl:call-template name="href.target">
                            <xsl:with-param name="object" select="$home"/>
                          </xsl:call-template>
                        </xsl:attribute>
                        <xsl:call-template name="navig.content">
                          <xsl:with-param name="direction" select="'home'"/>
                        </xsl:call-template>
                      </a>
                      <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
                        <xsl:text>&#160;|&#160;</xsl:text>
                      </xsl:if>
                    </xsl:when>
                    <xsl:otherwise>&#160;</xsl:otherwise>
                  </xsl:choose>

                  <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
                    <a accesskey="t">
                      <xsl:attribute name="href">
                        <xsl:apply-templates select="/*[1]"
                          mode="recursive-chunk-filename">
                          <xsl:with-param name="recursive" select="true()"/>
                        </xsl:apply-templates>
                        <xsl:text>-toc</xsl:text>
                        <xsl:value-of select="$html.ext"/>
                      </xsl:attribute>
                      <xsl:call-template name="gentext">
                        <xsl:with-param name="key" select="'nav-toc'"/>
                      </xsl:call-template>
                    </a>
                  </xsl:if>
                </td>
                <td width="40%" align="{$direction.align.end}" valign="top">
                  <xsl:text>&#160;</xsl:text>
                  <xsl:if test="$navig.showtitles != 0">
                    <xsl:apply-templates select="$next" mode="object.title.markup"/>
                  </xsl:if>
                </td>
              </tr>
            </xsl:if>
          </table>
        </xsl:if>
      </div>
    </xsl:if>
  </xsl:template>

  <!-- * ***************************************************************** -->
  <!-- *                                 Acknowledgements  -->
  <!-- * ***************************************************************** -->
  <!-- * This stylesheet is based on code from stylesheets in the DocBook -->
  <!-- * XSL Stylesheets distribution, which are distributed with the -->
  <!-- * following copyright statement. -->
  <!-- *  -->
  <!-- * Copyright -->
  <!-- *  -->
  <!-- * Copyright (C) 1999-2007 Norman Walsh -->
  <!-- * Copyright (C) 2003 Jiří Kosek -->
  <!-- * Copyright (C) 2004-2007 Steve Ball -->
  <!-- * Copyright (C) 2005-2008 The DocBook Project -->
  <!-- *  -->
  <!-- * Permission is hereby granted, free of charge, to any person -->
  <!-- * obtaining a copy of this software and associated documentation -->
  <!-- * files (the ``Software''), to deal in the Software without -->
  <!-- * restriction, including without limitation the rights to use, -->
  <!-- * copy, modify, merge, publish, distribute, sublicense, and/or -->
  <!-- * sell copies of the Software, and to permit persons to whom the -->
  <!-- * Software is furnished to do so, subject to the following -->
  <!-- * conditions: -->
  <!-- *  -->
  <!-- * The above copyright notice and this permission notice shall be -->
  <!-- * included in all copies or substantial portions of the Software. -->
  <!-- *  -->
  <!-- * Except as contained in this notice, the names of individuals -->
  <!-- * credited with contribution to this software shall not be used in -->
  <!-- * advertising or otherwise to promote the sale, use or other -->
  <!-- * dealings in this Software without prior written authorization -->
  <!-- * from the individuals in question. -->
  <!-- *  -->
  <!-- * Any stylesheet derived from this Software that is publically -->
  <!-- * distributed will be identified with a different name and the -->
  <!-- * version strings in any derived Software will be changed so that -->
  <!-- * no possibility of confusion between the derived package and this -->
  <!-- * Software will exist. -->
  <!-- *  -->
  <!-- * Warranty -->
  <!-- *  -->
  <!-- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
  <!-- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -->
  <!-- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -->
  <!-- * NONINFRINGEMENT.  IN NO EVENT SHALL NORMAN WALSH OR ANY OTHER -->
  <!-- * CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -->
  <!-- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -->
  <!-- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -->
  <!-- * OTHER DEALINGS IN THE SOFTWARE. -->
  <!-- *  -->
  <!-- * Contacting the Author -->
  <!-- *  -->
  <!-- * The DocBook XSL stylesheets are maintained by Norman Walsh, -->
  <!-- * <ndw@nwalsh.com>, and members of the DocBook Project, -->
  <!-- * <docbook-developers@sf.net> -->

</xsl:stylesheet>
Received on Friday, 1 May 2009 09:26:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 1 May 2009 09:26:22 GMT