W3C home > Mailing lists > Public > spec-prod@w3.org > October to December 2002

xmlspec stylesheets: filename parameters

From: David Carlisle <davidc@nag.co.uk>
Date: Wed, 27 Nov 2002 10:21:19 GMT
Message-Id: <200211271021.KAA07114@penguin.nag.co.uk>
To: spec-prod@w3.org



I have (finally) got round to updating the (internal) version of the
mathml spec sources to xmlspec version 2 (specifically the current version
2.2) and am looking to see if I can base the stylesheets on importing the
"standard" xmlspec stylesheet rather than  having a privately maintained
and diverging copy as before. 

I'm basing things on the stylesheets obtained from
http://www.w3.org/2002/xmlspec/


Rather than wait till I'd finished and then suggest an overwhelming
set of changes, I thought I'd raise issues as they occur...

The first issue is filenames of the result. If I use slices.xsl I get

index.html
slice1.html ... slice8.html
sliceA.html ... sliceK.html

but for reasons of compatbility with the existing URIs into the spec
(and because mixed case filenames are evil) I want to get

overview.html
chapter1.html ... chapter2.html
appendixa.html ... appendixk.html


Unfortunately the filenames are hardwired into several largish templates
the w3c house style seems to be to use overview.html for index files, so I'd
have thought several other specs might want that part at least.
Also the extension .html (might) want to be changed for xhtml versions,
so I made parameters for these things.

Any chance xmlspec v 2.x could have something that looks a bit like
the following?

David


<!-- for parameters, xmlspec defaults are commented out, mmlspec choices
are used, if these parameters were in xmlspec/slices, then only these
parameters would be needed here and the templates wouldnt need to be
copied -->

<!--
<xsl:param name="body.filename.base" select="'slice'"/>
<xsl:param name="back.filename.base" select="'slice'"/>
<xsl:param name="back.filename.format" select="'A'"/>
<xsl:param name="front.filename.base" select="'index'"/>
<xsl:param name="filename.extension" select="'.html'"/>
-->
<xsl:param name="body.filename.base" select="'chapter'"/>
<xsl:param name="back.filename.base" select="'appendix'"/>
<xsl:param name="back.filename.format" select="'a'"/>
<xsl:param name="front.filename.base" select="'overview'"/>
<xsl:param name="filename.extension" select="'.html'"/>


<xsl:template match="body/div1" mode="slice-filename">
  <xsl:variable name="docnumber">
    <xsl:number count="div1" level="multiple" format="1"/>
  </xsl:variable>
  <xsl:value-of select="$body.filename.base"/>
  <xsl:value-of select="$docnumber"/>
  <xsl:value-of select="$filename.extension"/>
</xsl:template>

<xsl:template match="back/div1 | inform-div1" mode="slice-filename">
  <xsl:variable name="docnumber">
    <xsl:number count="div1|inform-div1" level="multiple" format="{$back.filename.format}"/>
  </xsl:variable>
  <xsl:value-of select="$back.filename.base"/>
  <xsl:value-of select="$docnumber"/>
  <xsl:value-of select="$filename.extension"/>
</xsl:template>



<xsl:template match="spec" mode="slice-filename">
  <xsl:value-of select="$front.filename.base"/>
  <xsl:value-of select="$filename.extension"/>
</xsl:template>


<xsl:template name="navigation.top">
  <xsl:param name="prev" select="''"/>
  <xsl:param name="next" select="''"/>

  <a name="Top"/>
  <xsl:comment> TOP NAVIGATION BAR </xsl:comment>
  <table border="0" width="90%"
         cellpadding="4" cellspacing="0"
         bgcolor="#eeeeff"
         class="navigation"
summary="Navigation Bar">
    <col width="25%"/>
    <col width="25%"/>
    <col width="25%"/>
    <col width="25%"/>
    <tr>
      <td>&#xa0;</td>
      <td>&#xa0;</td>
      <td>&#xa0;</td>
      <td>&#xa0;</td>
    </tr>
    <tr>
      <td align="left">
        <a href="{$front.filename.base}{$filename.extension}#contents">Table of Contents</a>
      </td>
      <td align="left">
        <xsl:choose>
          <xsl:when test="$prev">
            <a>
              <xsl:attribute name="href">
                <xsl:call-template name="href.target">
                  <xsl:with-param name="target" select="$prev"/>
                  <xsl:with-param name="just.filename" select="1"/>
                </xsl:call-template>
              </xsl:attribute>
              <xsl:text>Prev</xsl:text>
            </a>
          </xsl:when>
          <xsl:otherwise>&#160;</xsl:otherwise>
        </xsl:choose>
      </td>
      <td align="left">
        <xsl:choose>
          <xsl:when test="$next">
            <a>
              <xsl:attribute name="href">
                <xsl:call-template name="href.target">
                  <xsl:with-param name="target" select="$next"/>
                  <xsl:with-param name="just.filename" select="1"/>
                </xsl:call-template>
              </xsl:attribute>
              <xsl:text>Next</xsl:text>
            </a>
          </xsl:when>
          <xsl:otherwise>&#160;</xsl:otherwise>
        </xsl:choose>
      </td>
      <td align="left">
        <a href="#Bottom">Bottom</a>
      </td>
    </tr>
  </table>

  <!-- quick table of contents -->
  <table border="0" width="90%"
         cellpadding="4" cellspacing="0" 
         bgcolor="#eeeeff"
         class="navigation-toc"
summary="Navigation TOC"
>
    <col width="100%"/>
    <tr align="left"><th><hr/>Quick Table of Contents<hr/></th></tr>
    <tr>
      <td>
        <xsl:apply-templates mode="toc" select=".">
          <xsl:with-param name="just.filename" select="'0'"/>
        </xsl:apply-templates>
      </td>
    </tr>
  </table>
</xsl:template>





<xsl:template name="navigation.bottom">
  <xsl:param name="prev" select="''"/>
  <xsl:param name="next" select="''"/>

  <a name="Bottom"/>
  <xsl:comment> BOTTOM NAVIGATION BAR </xsl:comment>
  <table border="0" width="90%"
         cellpadding="4" cellspacing="0"
         bgcolor="#eeeeff"
         class="navigation"
summary="Navigation">
    <col width="50%"/>
    <col width="50%"/>
    <tr><td>&#xa0;</td><td>&#xa0;</td></tr>
    <tr>
      <td align="left">
        <a href="{$front.filename.base}{$filename.extension}#contents">Table of Contents</a>
      </td>
      <td align="left">
        <a href="#Top">Top</a>
      </td>
    </tr>
  </table>
</xsl:template>





_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
Received on Wednesday, 27 November 2002 07:23:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:19:12 GMT