Re: Oxford comma in altlocs rendering

/ ht@cogsci.ed.ac.uk (Henry S. Thompson) was heard to say:
| I register a _very_ minor quibble with the way the altlocs list is
| rendered.  I find  "a, b, and c" very odd, particularly when the list
| members are short, as in "XML, Schema, and DTD".  I much prefer "a, b and c",
| i.e. "XML, Schema and DTD".

Like Tim and Michael, I prefer the Oxford style, but never let it be
said I tried to coerce you :-)

Here's a stylesheet layer on top of 1.3 that does it the way you want.
In 1.4, I'll have things refactored so you can override just the
altlocs template. I don't know what I was thinking (yes, I do, I was
thinking "how fast can I make this work" so that the Namespaces WD can
get past pubrules).

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

<xsl:import href="http://www.w3.org/2002/xmlspec/html/1.3/xmlspec.xsl"/>

  <xsl:template match="header">
    <div class="head">
      <xsl:if test="not(/spec/@role='editors-copy')">
        <p>
          <a href="http://www.w3.org/">
            <img src="http://www.w3.org/Icons/w3c_home"
              alt="W3C" height="48" width="72"/>
          </a>
        </p>
      </xsl:if>
      <xsl:text>&#10;</xsl:text>
      <h1>
        <xsl:call-template name="anchor">
          <xsl:with-param name="node" select="title[1]"/>
          <xsl:with-param name="conditional" select="0"/>
          <xsl:with-param name="default.id" select="'title'"/>
        </xsl:call-template>

        <xsl:apply-templates select="title"/>
        <xsl:if test="version">
          <xsl:text> </xsl:text>
          <xsl:apply-templates select="version"/>
        </xsl:if>
      </h1>
      <xsl:if test="subtitle">
        <xsl:text>&#10;</xsl:text>
        <h2>
          <xsl:call-template name="anchor">
            <xsl:with-param name="node" select="subtitle[1]"/>
            <xsl:with-param name="conditional" select="0"/>
            <xsl:with-param name="default.id" select="'subtitle'"/>
          </xsl:call-template>
          <xsl:apply-templates select="subtitle"/>
        </h2>
      </xsl:if>
      <xsl:text>&#10;</xsl:text>
      <h2>
        <xsl:call-template name="anchor">
          <xsl:with-param name="node" select="w3c-doctype[1]"/>
          <xsl:with-param name="conditional" select="0"/>
          <xsl:with-param name="default.id" select="'w3c-doctype'"/>
        </xsl:call-template>

        <xsl:apply-templates select="w3c-doctype"/>
        <xsl:text> </xsl:text>
        <xsl:if test="pubdate/day">
          <xsl:apply-templates select="pubdate/day"/>
          <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:apply-templates select="pubdate/month"/>
        <xsl:text> </xsl:text>
        <xsl:apply-templates select="pubdate/year"/>
      </h2>
      <dl>
        <xsl:apply-templates select="publoc"/>
        <xsl:apply-templates select="latestloc"/>
        <xsl:apply-templates select="prevlocs"/>
        <xsl:apply-templates select="authlist"/>
      </dl>

      <!-- output the altlocs -->
      <xsl:if test="altlocs">
        <p>
          <xsl:text>This document is also available </xsl:text>
          <xsl:text>in these non-normative formats: </xsl:text>
          <xsl:for-each select="altlocs/loc">
            <xsl:if test="position() &gt; 1">
              <xsl:if test="last() &gt; 2 and position() &lt; last()">,</xsl:if>
              <xsl:if test="last() &gt; 2">&#160;</xsl:if>
              <xsl:if test="last() = 2">&#160;</xsl:if>
            </xsl:if>
            <xsl:if test="position() = last() and position() &gt; 1">and&#160;</xsl:if>
            <a href="{@href}"><xsl:apply-templates/></a>
          </xsl:for-each>
          <xsl:text>.</xsl:text>
        </p>
      </xsl:if>

      <xsl:choose>
        <xsl:when test="copyright">
          <xsl:apply-templates select="copyright"/>
        </xsl:when>
        <xsl:otherwise>
          <p class="copyright">
            <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Copyright">
              <xsl:text>Copyright</xsl:text>
            </a>
            <xsl:text>&#xa0;&#xa9;&#xa0;</xsl:text>
            <xsl:apply-templates select="pubdate/year"/>
            <xsl:text>&#xa0;</xsl:text>
            <a href="http://www.w3.org/">
              <abbr title="World Wide Web Consortium">W3C</abbr>
            </a>
            <sup>&#xae;</sup>
            <xsl:text> (</xsl:text>
            <a href="http://www.lcs.mit.edu/">
              <abbr title="Massachusetts Institute of Technology">MIT</abbr>
            </a>
            <xsl:text>, </xsl:text>
            <a href="http://www.inria.fr/">
              <abbr lang="fr"
                    title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr>
            </a>
            <xsl:text>, </xsl:text>
            <a href="http://www.keio.ac.jp/">Keio</a>
            <xsl:text>), All Rights Reserved. W3C </xsl:text>
            <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Legal_Disclaimer">liability</a>
            <xsl:text>, </xsl:text>
            <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#W3C_Trademarks">trademark</a>
            <xsl:text>, </xsl:text>
            <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</a>
            <xsl:text>, and </xsl:text>
            <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</a>
            <xsl:text> rules apply.</xsl:text>
          </p>
        </xsl:otherwise>
      </xsl:choose>
    </div>
    <hr/>
    <xsl:apply-templates select="notice"/>
    <xsl:apply-templates select="abstract"/>
    <xsl:apply-templates select="status"/>
  </xsl:template>
</xsl:stylesheet>

                                        Be seeing you,
                                          norm

-- 
Norman.Walsh@Sun.COM    | The fact of having been born is bad augury
XML Standards Architect | for immortality.--Santayana
Sun Microsystems, Inc.  | 

Received on Tuesday, 3 September 2002 10:38:18 UTC