Ignore:
Timestamp:
01/05/14 07:47:52 (6 years ago)
Author:
julian.reschke@…
Message:

bump up document dates, update to latest version of rfc2629.xslt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rfc2629xslt/rfc2629.xslt

    r2627 r2628  
    251251</xsl:param>
    252252
     253<!-- extension for inserting RFC metadata -->
     254
     255<xsl:param name="xml2rfc-ext-insert-metadata">
     256  <xsl:call-template name="parse-pis">
     257    <xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
     258    <xsl:with-param name="attr" select="'insert-metadata'"/>
     259    <xsl:with-param name="default" select="'no'"/>
     260  </xsl:call-template>
     261</xsl:param>
     262
    253263<!-- extension for excluding DCMI properties in meta tag (RFC2731) -->
    254264
     
    297307    <xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
    298308    <xsl:with-param name="attr" select="'authors-section'"/>
     309    <xsl:with-param name="default" select="'end'"/>
    299310  </xsl:call-template>
    300311</xsl:param>
     
    10131024
    10141025  <!-- next, add information about the document's authors -->
    1015   <xsl:if test="$xml2rfc-ext-authors-section!='end'">
     1026  <xsl:if test="$xml2rfc-ext-authors-section='before-appendices'">
    10161027    <xsl:call-template name="insertAuthors" />
    10171028  </xsl:if>
     
    10791090  <div id="{$anch}" />
    10801091  <xsl:apply-templates />
    1081   <xsl:if test="(@title!='' or @anchor!='') and not(@suppress-title='true')">
     1092  <xsl:if test="(@title!='') or (@anchor!='' and not(@suppress-title='true'))">
    10821093    <xsl:variable name="n"><xsl:call-template name="get-figure-number"/></xsl:variable>
    1083     <p class="figure">Figure <xsl:value-of select="$n"/><xsl:if test="@title!=''">: <xsl:value-of select="@title" /></xsl:if></p>
     1094    <p class="figure">
     1095      <xsl:if test="not(starts-with($n,'u'))">
     1096        <xsl:text>Figure </xsl:text>
     1097        <xsl:value-of select="$n"/>
     1098        <xsl:if test="@title!=''">: </xsl:if>
     1099      </xsl:if>
     1100      <xsl:if test="@title!=''">
     1101        <xsl:value-of select="@title" />
     1102      </xsl:if>
     1103    </p>
    10841104  </xsl:if>
    10851105</xsl:template>
     
    20322052        <xsl:apply-templates select="front/title" mode="get-text-content" />
    20332053      </title>
    2034       <xsl:call-template name="insertScript" />
     2054      <xsl:call-template name="insertScripts" />
    20352055      <xsl:call-template name="insertCss" />
    20362056      <!-- <link rel="alternate stylesheet" type="text/css" media="screen" title="Plain (typewriter)" href="rfc2629tty.css" /> -->
     
    21452165    </head>
    21462166    <body>
    2147       <xsl:if test="/rfc/x:feedback">
    2148         <xsl:attribute name="onload">init();</xsl:attribute>
     2167      <xsl:if test="/rfc/x:feedback or ($xml2rfc-ext-insert-metadata='yes' and /rfc/@number)">
     2168        <xsl:attribute name="onload">
     2169          <xsl:if test="$xml2rfc-ext-insert-metadata='yes' and /rfc/@number">getMeta(<xsl:value-of select="/rfc/@number"/>,"rfc.meta");</xsl:if>
     2170          <xsl:if test="/rfc/x:feedback">initFeedback();</xsl:if>
     2171        </xsl:attribute>
    21492172      </xsl:if>
    21502173
     
    22912314  </xsl:variable>
    22922315
     2316  <xsl:if test="$xml2rfc-ext-insert-metadata='yes' and $rfcno!='' and @anchor='rfc.status'">
     2317    <div id="rfc.meta" style="float: right; border: 1px solid black; margin: 2em; padding: 1em; display: none;"></div>
     2318  </xsl:if>
    22932319  <div>
    22942320    <xsl:if test="@anchor">
     
    35523578
    35533579<!-- optional scripts -->
    3554 <xsl:template name="insertScript">
     3580<xsl:template name="insertScripts">
    35553581<xsl:if test="/rfc/x:feedback">
    35563582<script>
    35573583var buttonsAdded = false;
    35583584
    3559 function init() {
     3585function initFeedback() {
    35603586  var fb = document.createElement("div");
    35613587  fb.className = "feedback noprint";
     
    36413667  }
    36423668}</script>
     3669</xsl:if>
     3670<xsl:if test="$xml2rfc-ext-insert-metadata='yes' and $rfcno!=''">
     3671<script>
     3672function getMeta(rfcno, container) {
     3673
     3674  var xhr = new XMLHttpRequest();
     3675  xhr.open("GET", "http://tools.ietf.org/draft/rfc" + rfcno + "/state.xml", true);
     3676  xhr.onload = function (e) {
     3677    if (xhr.readyState === 4) {
     3678      if (xhr.status === 200) {
     3679        var doc = xhr.responseXML;
     3680        var info = getChildByName(doc.documentElement, "info");
     3681 
     3682        var cont = document.getElementById(container);
     3683        // empty the container
     3684        while (cont.firstChild) {
     3685          cont.removeChild(myNode.firstChild);
     3686        }     
     3687 
     3688        var c = getChildByName(info, "stdstatus");
     3689        if (c !== null) {
     3690          var bld = newElementWithText("b", c.textContent);
     3691          cont.appendChild(bld);
     3692        }
     3693 
     3694        c = getChildByName(info, "updatedby");
     3695        if (c !== null) {
     3696          cont.appendChild(newElement("br"));
     3697          cont.appendChild(newText("Updated by: "));
     3698          appendRfcLinks(cont, c.textContent);
     3699        }
     3700 
     3701        c = getChildByName(info, "obsoletedby");
     3702        if (c !== null) {
     3703          cont.appendChild(newElement("br"));
     3704          cont.appendChild(newText("Obsoleted by: "));
     3705          appendRfcLinks(cont, c.textContent);
     3706        }
     3707       
     3708        insertErrata(rfcno, cont);
     3709 
     3710        cont.style.display = "block";
     3711      } else {
     3712        console.error(xhr.statusText);
     3713      }
     3714    }
     3715  };
     3716  xhr.onerror = function (e) {
     3717    console.error(xhr.status + " " + xhr.statusText);
     3718  };
     3719  xhr.send(null);
     3720}
     3721
     3722function insertErrata(rfcno, container) {
     3723  var xhr = new XMLHttpRequest();
     3724  xhr.open("GET", "http://greenbytes.de/tech/webdav/rfcerrata.raw", true);
     3725  xhr.onload = function (e) {
     3726    if (xhr.readyState === 4) {
     3727      if (xhr.status === 200) {
     3728        var t = "\n" + xhr.responseText + "\n";
     3729        if (t.indexOf(rfcno) >= 0) {
     3730          container.appendChild(newElement("br"));
     3731          var link = newElementWithText("a", "errata");
     3732          link.setAttribute("href", "http://www.rfc-editor.org/errata_search.php?rfc=" + rfcno);
     3733          var errata = newElementWithText("i", "This document has ");
     3734          errata.appendChild(link);
     3735          errata.appendChild(newText("."));
     3736          container.appendChild(errata);
     3737        }
     3738      } else {
     3739        console.error(xhr.statusText);
     3740      }
     3741    }
     3742  };
     3743  xhr.onerror = function (e) {
     3744    console.error(xhr.status + " " + xhr.statusText);
     3745  };
     3746  xhr.send(null);
     3747}
     3748
     3749// DOM helpers
     3750function newElement(name) {
     3751  return document.createElement(name);
     3752}
     3753function newElementWithText(name, txt) {
     3754  var e = document.createElement(name);
     3755  e.appendChild(newText(txt));
     3756  return e;
     3757}
     3758function newText(text) {
     3759  return document.createTextNode(text);
     3760}
     3761
     3762function getChildByName(parent, name) {
     3763  if (parent === null) {
     3764    return null;
     3765  }
     3766  else {
     3767    for (var c = parent.firstChild; c !== null; c = c.nextSibling) {
     3768      if (name == c.nodeName) {
     3769        return c;
     3770      }
     3771    }
     3772    return null;
     3773  }
     3774}
     3775
     3776function appendRfcLinks(parent, text) {
     3777  var updates = text.split(",");
     3778  for (var i = 0; i &lt; updates.length; i++) {
     3779    var rfc = updates[i].trim();
     3780    if (rfc.substring(0, 3) == "rfc") {
     3781      var link = newElement("a");
     3782      link.setAttribute("href", "http://tools.ietf.org/html/" + rfc);
     3783      link.appendChild(newText(rfc.substring(3)));
     3784      parent.appendChild(link);
     3785    } else {
     3786      parent.appendChild(newText(rfc));
     3787    }
     3788    if (i != updates.length - 1) {
     3789      parent.appendChild(newText(", "));
     3790    }
     3791  }
     3792}
     3793</script>
    36433794</xsl:if>
    36443795</xsl:template>
     
    51255276  <xsl:param name="waschanged" />
    51265277
     5278  <xsl:variable name="depth">
     5279    <!-- count the dots -->
     5280    <xsl:value-of select="string-length(translate($number,'.ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890&#167;','.'))"/>
     5281  </xsl:variable>
     5282 
    51275283  <!-- handle tocdepth parameter -->
    51285284  <xsl:choose>
    5129     <xsl:when test="($tocparam='' or $tocparam='default') and string-length(translate($number,'.ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890&#167;','.')) &gt;= $parsedTocDepth">
     5285    <xsl:when test="(not($tocparam) or $tocparam='' or $tocparam='default') and $depth >= $parsedTocDepth">
    51305286      <!-- dropped entry because excluded -->
    51315287      <xsl:attribute name="class">excluded</xsl:attribute>
     
    51805336  </xsl:if>
    51815337
    5182   <xsl:if test="$xml2rfc-ext-authors-section!='end'">
     5338  <xsl:if test="$xml2rfc-ext-authors-section='before-appendices'">
    51835339    <xsl:apply-templates select="/rfc/front" mode="toc" />
    51845340  </xsl:if>
     
    66006756
    66016757    <table class="{$style}" cellpadding="3" cellspacing="0">
    6602       <xsl:if test="(@title!='' or @anchor!='') and not(@suppress-title='true')">
     6758      <xsl:if test="(@title!='') or (@anchor!='' and not(@suppress-title='true'))">
    66036759        <xsl:variable name="n"><xsl:call-template name="get-table-number"/></xsl:variable>
    6604         <caption>Table <xsl:value-of select="$n"/><xsl:if test="@title!=''">: <xsl:value-of select="@title" /></xsl:if></caption>
     6760        <caption>
     6761          <xsl:if test="not(starts-with($n,'u'))">
     6762            <xsl:text>Table </xsl:text>
     6763            <xsl:value-of select="$n"/>
     6764            <xsl:if test="@title!=''">: </xsl:if>
     6765          </xsl:if>
     6766          <xsl:if test="@title!=''">
     6767            <xsl:value-of select="@title" />
     6768          </xsl:if>
     6769        </caption>
    66056770      </xsl:if>
    66066771
     
    68857050    <xsl:text>http://greenbytes.de/tech/webdav/rfc2629.xslt, </xsl:text>
    68867051    <!-- when RCS keyword substitution in place, add version info -->
    6887     <xsl:if test="contains('$Revision: 1.624 $',':')">
    6888       <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.624 $', 'Revision: '),'$','')),', ')" />
     7052    <xsl:if test="contains('$Revision: 1.629 $',':')">
     7053      <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.629 $', 'Revision: '),'$','')),', ')" />
    68897054    </xsl:if>
    6890     <xsl:if test="contains('$Date: 2014/03/28 12:53:01 $',':')">
    6891       <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2014/03/28 12:53:01 $', 'Date: '),'$','')),', ')" />
     7055    <xsl:if test="contains('$Date: 2014/04/17 09:22:01 $',':')">
     7056      <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2014/04/17 09:22:01 $', 'Date: '),'$','')),', ')" />
    68927057    </xsl:if>
    68937058    <xsl:value-of select="concat('XSLT vendor: ',system-property('xsl:vendor'),' ',system-property('xsl:vendor-url'))" />
     
    69907155<xsl:template name="get-table-number">
    69917156  <xsl:choose>
    6992     <xsl:when test="@title!='' or @anchor!=''">
    6993       <xsl:number level="any" count="texttable[@title!='' or @anchor!='']" />
     7157    <xsl:when test="@anchor!=''">
     7158      <xsl:number level="any" count="texttable[@anchor!='']" />
    69947159    </xsl:when>
    69957160    <xsl:otherwise>
    69967161      <xsl:text>u.</xsl:text>
    6997       <xsl:number level="any" count="texttable[not(@title!='' or @anchor!='')]" />
     7162      <xsl:number level="any" count="texttable[not(@anchor) or @anchor='']" />
    69987163    </xsl:otherwise>
    69997164  </xsl:choose>
     
    70087173<xsl:template name="get-figure-number">
    70097174  <xsl:choose>
    7010     <xsl:when test="@title!='' or @anchor!=''">
    7011       <xsl:number level="any" count="figure[@title!='' or @anchor!='']" />
     7175    <xsl:when test="@anchor!=''">
     7176      <xsl:number level="any" count="figure[@anchor!='']" />
    70127177    </xsl:when>
    70137178    <xsl:otherwise>
    70147179      <xsl:text>u.</xsl:text>
    7015       <xsl:number level="any" count="figure[not(@title!='' or @anchor!='')]" />
     7180      <xsl:number level="any" count="figure[not(@anchor) or @anchor='']" />
    70167181    </xsl:otherwise>
    70177182  </xsl:choose>
Note: See TracChangeset for help on using the changeset viewer.