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/rfc2629toXHTML.xslt

    r2627 r2628  
    207207</xsl:param>
    208208
     209<!-- extension for inserting RFC metadata -->
     210
     211<xsl:param name="xml2rfc-ext-insert-metadata">
     212  <xsl:call-template name="parse-pis">
     213    <xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
     214    <xsl:with-param name="attr" select="'insert-metadata'"/>
     215    <xsl:with-param name="default" select="'no'"/>
     216  </xsl:call-template>
     217</xsl:param>
     218
    209219<!-- extension for excluding DCMI properties in meta tag (RFC2731) -->
    210220
     
    253263    <xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
    254264    <xsl:with-param name="attr" select="'authors-section'"/>
     265    <xsl:with-param name="default" select="'end'"/>
    255266  </xsl:call-template>
    256267</xsl:param>
     
    881892
    882893  <!-- next, add information about the document's authors -->
    883   <xsl:if test="$xml2rfc-ext-authors-section!='end'">
     894  <xsl:if test="$xml2rfc-ext-authors-section='before-appendices'">
    884895    <xsl:call-template name="insertAuthors"/>
    885896  </xsl:if>
     
    947958  <div xmlns="http://www.w3.org/1999/xhtml" id="{$anch}"/>
    948959  <xsl:apply-templates/>
    949   <xsl:if test="(@title!='' or @anchor!='') and not(@suppress-title='true')">
     960  <xsl:if test="(@title!='') or (@anchor!='' and not(@suppress-title='true'))">
    950961    <xsl:variable name="n"><xsl:call-template name="get-figure-number"/></xsl:variable>
    951     <p xmlns="http://www.w3.org/1999/xhtml" class="figure">Figure <xsl:value-of select="$n"/><xsl:if test="@title!=''">: <xsl:value-of select="@title"/></xsl:if></p>
     962    <p xmlns="http://www.w3.org/1999/xhtml" class="figure">
     963      <xsl:if test="not(starts-with($n,'u'))">
     964        <xsl:text>Figure </xsl:text>
     965        <xsl:value-of select="$n"/>
     966        <xsl:if test="@title!=''">: </xsl:if>
     967      </xsl:if>
     968      <xsl:if test="@title!=''">
     969        <xsl:value-of select="@title"/>
     970      </xsl:if>
     971    </p>
    952972  </xsl:if>
    953973</xsl:template>
     
    19001920        <xsl:apply-templates select="front/title" mode="get-text-content"/>
    19011921      </title>
    1902       <xsl:call-template name="insertScript"/>
     1922      <xsl:call-template name="insertScripts"/>
    19031923      <xsl:call-template name="insertCss"/>
    19041924      <!-- <link rel="alternate stylesheet" type="text/css" media="screen" title="Plain (typewriter)" href="rfc2629tty.css" /> -->
     
    20132033    </head>
    20142034    <body>
    2015       <xsl:if test="/rfc/x:feedback">
    2016         <xsl:attribute name="onload">init();</xsl:attribute>
     2035      <xsl:if test="/rfc/x:feedback or ($xml2rfc-ext-insert-metadata='yes' and /rfc/@number)">
     2036        <xsl:attribute name="onload">
     2037          <xsl:if test="$xml2rfc-ext-insert-metadata='yes' and /rfc/@number">getMeta(<xsl:value-of select="/rfc/@number"/>,"rfc.meta");</xsl:if>
     2038          <xsl:if test="/rfc/x:feedback">initFeedback();</xsl:if>
     2039        </xsl:attribute>
    20172040      </xsl:if>
    20182041
     
    21592182  </xsl:variable>
    21602183
     2184  <xsl:if test="$xml2rfc-ext-insert-metadata='yes' and $rfcno!='' and @anchor='rfc.status'">
     2185    <div xmlns="http://www.w3.org/1999/xhtml" id="rfc.meta" style="float: right; border: 1px solid black; margin: 2em; padding: 1em; display: none;"/>
     2186  </xsl:if>
    21612187  <div xmlns="http://www.w3.org/1999/xhtml">
    21622188    <xsl:if test="@anchor">
     
    34203446
    34213447<!-- optional scripts -->
    3422 <xsl:template name="insertScript">
     3448<xsl:template name="insertScripts">
    34233449<xsl:if test="/rfc/x:feedback">
    34243450<script xmlns="http://www.w3.org/1999/xhtml">
    34253451var buttonsAdded = false;
    34263452
    3427 function init() {
     3453function initFeedback() {
    34283454  var fb = document.createElement("div");
    34293455  fb.className = "feedback noprint";
     
    35093535  }
    35103536}</script>
     3537</xsl:if>
     3538<xsl:if test="$xml2rfc-ext-insert-metadata='yes' and $rfcno!=''">
     3539<script xmlns="http://www.w3.org/1999/xhtml">
     3540function getMeta(rfcno, container) {
     3541
     3542  var xhr = new XMLHttpRequest();
     3543  xhr.open("GET", "http://tools.ietf.org/draft/rfc" + rfcno + "/state.xml", true);
     3544  xhr.onload = function (e) {
     3545    if (xhr.readyState === 4) {
     3546      if (xhr.status === 200) {
     3547        var doc = xhr.responseXML;
     3548        var info = getChildByName(doc.documentElement, "info");
     3549 
     3550        var cont = document.getElementById(container);
     3551        // empty the container
     3552        while (cont.firstChild) {
     3553          cont.removeChild(myNode.firstChild);
     3554        }     
     3555 
     3556        var c = getChildByName(info, "stdstatus");
     3557        if (c !== null) {
     3558          var bld = newElementWithText("b", c.textContent);
     3559          cont.appendChild(bld);
     3560        }
     3561 
     3562        c = getChildByName(info, "updatedby");
     3563        if (c !== null) {
     3564          cont.appendChild(newElement("br"));
     3565          cont.appendChild(newText("Updated by: "));
     3566          appendRfcLinks(cont, c.textContent);
     3567        }
     3568 
     3569        c = getChildByName(info, "obsoletedby");
     3570        if (c !== null) {
     3571          cont.appendChild(newElement("br"));
     3572          cont.appendChild(newText("Obsoleted by: "));
     3573          appendRfcLinks(cont, c.textContent);
     3574        }
     3575       
     3576        insertErrata(rfcno, cont);
     3577 
     3578        cont.style.display = "block";
     3579      } else {
     3580        console.error(xhr.statusText);
     3581      }
     3582    }
     3583  };
     3584  xhr.onerror = function (e) {
     3585    console.error(xhr.status + " " + xhr.statusText);
     3586  };
     3587  xhr.send(null);
     3588}
     3589
     3590function insertErrata(rfcno, container) {
     3591  var xhr = new XMLHttpRequest();
     3592  xhr.open("GET", "http://greenbytes.de/tech/webdav/rfcerrata.raw", true);
     3593  xhr.onload = function (e) {
     3594    if (xhr.readyState === 4) {
     3595      if (xhr.status === 200) {
     3596        var t = "\n" + xhr.responseText + "\n";
     3597        if (t.indexOf(rfcno) &gt;= 0) {
     3598          container.appendChild(newElement("br"));
     3599          var link = newElementWithText("a", "errata");
     3600          link.setAttribute("href", "http://www.rfc-editor.org/errata_search.php?rfc=" + rfcno);
     3601          var errata = newElementWithText("i", "This document has ");
     3602          errata.appendChild(link);
     3603          errata.appendChild(newText("."));
     3604          container.appendChild(errata);
     3605        }
     3606      } else {
     3607        console.error(xhr.statusText);
     3608      }
     3609    }
     3610  };
     3611  xhr.onerror = function (e) {
     3612    console.error(xhr.status + " " + xhr.statusText);
     3613  };
     3614  xhr.send(null);
     3615}
     3616
     3617// DOM helpers
     3618function newElement(name) {
     3619  return document.createElement(name);
     3620}
     3621function newElementWithText(name, txt) {
     3622  var e = document.createElement(name);
     3623  e.appendChild(newText(txt));
     3624  return e;
     3625}
     3626function newText(text) {
     3627  return document.createTextNode(text);
     3628}
     3629
     3630function getChildByName(parent, name) {
     3631  if (parent === null) {
     3632    return null;
     3633  }
     3634  else {
     3635    for (var c = parent.firstChild; c !== null; c = c.nextSibling) {
     3636      if (name == c.nodeName) {
     3637        return c;
     3638      }
     3639    }
     3640    return null;
     3641  }
     3642}
     3643
     3644function appendRfcLinks(parent, text) {
     3645  var updates = text.split(",");
     3646  for (var i = 0; i &lt; updates.length; i++) {
     3647    var rfc = updates[i].trim();
     3648    if (rfc.substring(0, 3) == "rfc") {
     3649      var link = newElement("a");
     3650      link.setAttribute("href", "http://tools.ietf.org/html/" + rfc);
     3651      link.appendChild(newText(rfc.substring(3)));
     3652      parent.appendChild(link);
     3653    } else {
     3654      parent.appendChild(newText(rfc));
     3655    }
     3656    if (i != updates.length - 1) {
     3657      parent.appendChild(newText(", "));
     3658    }
     3659  }
     3660}
     3661</script>
    35113662</xsl:if>
    35123663</xsl:template>
     
    49815132  <xsl:param name="waschanged"/>
    49825133
     5134  <xsl:variable name="depth">
     5135    <!-- count the dots -->
     5136    <xsl:value-of select="string-length(translate($number,'.ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890§','.'))"/>
     5137  </xsl:variable>
     5138 
    49835139  <!-- handle tocdepth parameter -->
    49845140  <xsl:choose>
    4985     <xsl:when test="($tocparam='' or $tocparam='default') and string-length(translate($number,'.ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890§','.')) &gt;= $parsedTocDepth">
     5141    <xsl:when test="(not($tocparam) or $tocparam='' or $tocparam='default') and $depth &gt;= $parsedTocDepth">
    49865142      <!-- dropped entry because excluded -->
    49875143      <xsl:attribute name="class">excluded</xsl:attribute>
     
    50365192  </xsl:if>
    50375193
    5038   <xsl:if test="$xml2rfc-ext-authors-section!='end'">
     5194  <xsl:if test="$xml2rfc-ext-authors-section='before-appendices'">
    50395195    <xsl:apply-templates select="/rfc/front" mode="toc"/>
    50405196  </xsl:if>
     
    64576613
    64586614    <table class="{$style}" cellpadding="3" cellspacing="0">
    6459       <xsl:if test="(@title!='' or @anchor!='') and not(@suppress-title='true')">
     6615      <xsl:if test="(@title!='') or (@anchor!='' and not(@suppress-title='true'))">
    64606616        <xsl:variable name="n"><xsl:call-template name="get-table-number"/></xsl:variable>
    6461         <caption>Table <xsl:value-of select="$n"/><xsl:if test="@title!=''">: <xsl:value-of select="@title"/></xsl:if></caption>
     6617        <caption>
     6618          <xsl:if test="not(starts-with($n,'u'))">
     6619            <xsl:text>Table </xsl:text>
     6620            <xsl:value-of select="$n"/>
     6621            <xsl:if test="@title!=''">: </xsl:if>
     6622          </xsl:if>
     6623          <xsl:if test="@title!=''">
     6624            <xsl:value-of select="@title"/>
     6625          </xsl:if>
     6626        </caption>
    64626627      </xsl:if>
    64636628
     
    67426907    <xsl:text>http://greenbytes.de/tech/webdav/rfc2629.xslt, </xsl:text>
    67436908    <!-- when RCS keyword substitution in place, add version info -->
    6744     <xsl:if test="contains('$Revision: 1.624 $',':')">
    6745       <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.624 $', 'Revision: '),'$','')),', ')"/>
     6909    <xsl:if test="contains('$Revision: 1.629 $',':')">
     6910      <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.629 $', 'Revision: '),'$','')),', ')"/>
    67466911    </xsl:if>
    6747     <xsl:if test="contains('$Date: 2014/03/28 12:53:01 $',':')">
    6748       <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2014/03/28 12:53:01 $', 'Date: '),'$','')),', ')"/>
     6912    <xsl:if test="contains('$Date: 2014/04/17 09:22:01 $',':')">
     6913      <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2014/04/17 09:22:01 $', 'Date: '),'$','')),', ')"/>
    67496914    </xsl:if>
    67506915    <xsl:value-of select="concat('XSLT vendor: ',system-property('xsl:vendor'),' ',system-property('xsl:vendor-url'))"/>
     
    68477012<xsl:template name="get-table-number">
    68487013  <xsl:choose>
    6849     <xsl:when test="@title!='' or @anchor!=''">
    6850       <xsl:number level="any" count="texttable[@title!='' or @anchor!='']"/>
     7014    <xsl:when test="@anchor!=''">
     7015      <xsl:number level="any" count="texttable[@anchor!='']"/>
    68517016    </xsl:when>
    68527017    <xsl:otherwise>
    68537018      <xsl:text>u.</xsl:text>
    6854       <xsl:number level="any" count="texttable[not(@title!='' or @anchor!='')]"/>
     7019      <xsl:number level="any" count="texttable[not(@anchor) or @anchor='']"/>
    68557020    </xsl:otherwise>
    68567021  </xsl:choose>
     
    68657030<xsl:template name="get-figure-number">
    68667031  <xsl:choose>
    6867     <xsl:when test="@title!='' or @anchor!=''">
    6868       <xsl:number level="any" count="figure[@title!='' or @anchor!='']"/>
     7032    <xsl:when test="@anchor!=''">
     7033      <xsl:number level="any" count="figure[@anchor!='']"/>
    68697034    </xsl:when>
    68707035    <xsl:otherwise>
    68717036      <xsl:text>u.</xsl:text>
    6872       <xsl:number level="any" count="figure[not(@title!='' or @anchor!='')]"/>
     7037      <xsl:number level="any" count="figure[not(@anchor) or @anchor='']"/>
    68737038    </xsl:otherwise>
    68747039  </xsl:choose>
Note: See TracChangeset for help on using the changeset viewer.