Changeset 1303 for rfc2629xslt/samples


Ignore:
Timestamp:
01/06/11 09:03:44 (9 years ago)
Author:
julian.reschke@…
Message:

update rfc2629.xslt, bump up document dates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rfc2629xslt/samples/rfc2629.xslt

    r1276 r1303  
    231231</xsl:param>
    232232
     233<!-- extension for excluding the index -->
     234
     235<xsl:param name="xml2rfc-ext-include-index">
     236  <xsl:call-template name="parse-pis">
     237    <xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
     238    <xsl:with-param name="attr" select="'include-index'"/>
     239    <xsl:with-param name="default" select="'yes'"/>
     240  </xsl:call-template>
     241</xsl:param>
     242
    233243<!-- extension for excluding DCMI properties in meta tag (RFC2731) -->
    234244
     
    425435    <xsl:call-template name="warning">
    426436      <xsl:with-param name="msg" select="concat('/rfc/@consensus meaningless with a /rfc/@submissionType value of ', /rfc/@submissionType)"/>
    427       <xsl:with-param name="inline" select="'no'"/>
    428437    </xsl:call-template>
    429438  </xsl:if>
     
    561570
    562571<!-- will document have an index -->
    563 <xsl:variable name="has-index" select="//iref or (//xref and $xml2rfc-ext-include-references-in-index='yes')" />
     572<xsl:variable name="has-index" select="(//iref or (//xref and $xml2rfc-ext-include-references-in-index='yes')) and $xml2rfc-ext-include-index!='no'" />
    564573         
    565574<!-- does the document contain edits? -->
     
    737746      <xsl:if test="string-length($content) > 69 + $indent">
    738747        <xsl:call-template name="warning">
    739           <xsl:with-param name="inline" select="'no'"/>
    740748          <xsl:with-param name="msg">artwork line too long: '<xsl:value-of select="$content"/>' (<xsl:value-of select="string-length($content)"/> characters)</xsl:with-param>
    741749        </xsl:call-template>
     
    753761      <xsl:if test="string-length($start) > $max">
    754762        <xsl:call-template name="warning">
    755           <xsl:with-param name="inline" select="'no'"/>
    756763          <xsl:with-param name="msg">artwork line too long: '<xsl:value-of select="$start"/>' (<xsl:value-of select="string-length($start)"/> characters)</xsl:with-param>
    757764        </xsl:call-template>
     
    10631070            <xsl:call-template name="warning">
    10641071              <xsl:with-param name="msg">The @docName attribute '<xsl:value-of select="$docname"/>' should contain the base name, not the filename (thus no file extension).</xsl:with-param>
    1065               <xsl:with-param name="inline" select="'no'"/>
    10661072            </xsl:call-template>
    10671073            <xsl:value-of select="substring-before($docname,'.')"/>
     
    10781084        <xsl:call-template name="warning">
    10791085          <xsl:with-param name="msg">The @docName attribute '<xsl:value-of select="$docname"/>' should not contain the character '<xsl:value-of select="substring($offending,1,1)"/>'.</xsl:with-param>
    1080           <xsl:with-param name="inline" select="'no'"/>
    10811086        </xsl:call-template>
    10821087      </xsl:if>
     
    10861091        <xsl:call-template name="warning">
    10871092          <xsl:with-param name="msg">The @docName attribute '<xsl:value-of select="$docname"/>' should not contain the character sequence '--'.</xsl:with-param>
    1088           <xsl:with-param name="inline" select="'no'"/>
    10891093        </xsl:call-template>
    10901094      </xsl:if>
     
    10931097        <xsl:call-template name="warning">
    10941098          <xsl:with-param name="msg">The @docName attribute '<xsl:value-of select="$docname"/>' should start with 'draft-'.</xsl:with-param>
    1095           <xsl:with-param name="inline" select="'no'"/>
    10961099        </xsl:call-template>
    10971100      </xsl:if>
     
    11091112        <xsl:call-template name="warning">
    11101113          <xsl:with-param name="msg">The @docName attribute '<xsl:value-of select="$docname"/>' should end with a two-digit sequence number or 'latest'.</xsl:with-param>
    1111           <xsl:with-param name="inline" select="'no'"/>
    11121114        </xsl:call-template>
    11131115      </xsl:if>
     
    11161118        <xsl:call-template name="warning">
    11171119          <xsl:with-param name="msg">The @docName attribute '<xsl:value-of select="$docname"/>', excluding sequence number, should have less than 50 characters.</xsl:with-param>
    1118           <xsl:with-param name="inline" select="'no'"/>
    11191120        </xsl:call-template>
    11201121      </xsl:if>
     
    15301531  <xsl:if test="not(ancestor::ed:del) and not(key('xref-item',$anchor))">
    15311532    <xsl:call-template name="warning">
    1532       <xsl:with-param name="inline" select="'no'"/>
    15331533      <xsl:with-param name="msg">unused reference '<xsl:value-of select="@anchor"/>'</xsl:with-param>
    15341534    </xsl:call-template>
     
    15481548    <xsl:if test="$tst=''">
    15491549      <xsl:call-template name="warning">
    1550         <xsl:with-param name="inline" select="'no'"/>
    15511550        <xsl:with-param name="msg">all references to the normative reference '<xsl:value-of select="@anchor"/>' appear to be informative</xsl:with-param>
    15521551      </xsl:call-template>
     
    16851684        <xsl:if test="(@name='BCP' or @name='FYI' or @name='STD') and preceding-sibling::seriesInfo[@name='RFC']">
    16861685          <xsl:call-template name="warning">
    1687             <xsl:with-param name="inline" select="'no'"/>
    16881686            <xsl:with-param name="msg">RFC number preceding <xsl:value-of select="@name"/> number in reference '<xsl:value-of select="../@anchor"/>'</xsl:with-param>
    16891687          </xsl:call-template>
     
    17011699        <xsl:if test="string(number(front/date/@year)) = 'NaN'">
    17021700          <xsl:call-template name="warning">
    1703             <xsl:with-param name="inline" select="'no'"/>
    17041701            <xsl:with-param name="msg">date/@year should be a number: '<xsl:value-of select="front/date/@year"/>' in reference '<xsl:value-of select="@anchor"/>'</xsl:with-param>
    17051702          </xsl:call-template>
     
    19531950<xsl:template match="t">
    19541951  <xsl:if test="preceding-sibling::section or preceding-sibling::appendix">
    1955     <xsl:call-template name="warning">
     1952    <xsl:call-template name="inline-warning">
    19561953      <xsl:with-param name="msg">The paragraph below is misplaced; maybe a section is closed in the wrong place: </xsl:with-param>
    19571954      <xsl:with-param name="msg2"><xsl:value-of select="."/></xsl:with-param>
     
    20192016  <xsl:if test="@abbrev and string-length(@abbrev) > 40">
    20202017    <xsl:call-template name="warning">
    2021       <xsl:with-param name="inline" select="'no'"/>
    20222018      <xsl:with-param name="msg">title/@abbrev too long (max 40 characters)</xsl:with-param>
    20232019    </xsl:call-template>
     
    20262022  <xsl:if test="string-length(.) > 40 and (not(@abbrev) or @abbrev='')">
    20272023    <xsl:call-template name="warning">
    2028       <xsl:with-param name="inline" select="'no'"/>
    20292024      <xsl:with-param name="msg">title too long, should supply title/@abbrev attribute with less than 40 characters</xsl:with-param>
    20302025    </xsl:call-template>
     
    20602055  <xsl:if test="self::appendix">
    20612056    <xsl:call-template name="warning">
    2062       <xsl:with-param name="inline" select="'no'"/>
    20632057      <xsl:with-param name="msg">The "appendix" element is deprecated, use "section" inside "back" instead.</xsl:with-param>
    20642058    </xsl:call-template>
     
    22942288        <xsl:if test="not($r-is-normative)">
    22952289          <xsl:call-template name="warning">
    2296             <xsl:with-param name="inline" select="'no'"/>
    22972290            <xsl:with-param name="msg" select="concat('Potentially normative reference to ',@target,' not referenced normatively')"/>
    22982291          </xsl:call-template>
     
    24612454            <xsl:for-each select="$xref">
    24622455              <xsl:call-template name="warning">
    2463                 <xsl:with-param name="inline" select="'no'"/>
    24642456                <xsl:with-param name="msg" select="concat('Potentially normative reference to ',$xref/@target,' not referenced normatively')"/>
    24652457              </xsl:call-template>
     
    26692661
    26702662<xsl:template match="/">
     2663  <xsl:apply-templates select="*" mode="validate"/>
    26712664  <xsl:apply-templates select="*" />
    26722665</xsl:template>
     
    28142807      <xsl:call-template name="warning">
    28152808        <xsl:with-param name="msg" select="concat('/rfc/front/date/@day appears to be missing for a historic draft dated ', $pub-yearmonth)"/>
    2816         <xsl:with-param name="inline" select="'no'"/>
    28172809      </xsl:call-template>
    28182810    </xsl:if>
     
    49924984      <xsl:value-of select="$name"/>
    49934985      <xsl:call-template name="warning">
    4994         <xsl:with-param name="inline" select="'no'"/>
    49954986        <xsl:with-param name="msg" select="concat('In metadata obsoletes/updates, RFC number of draft name is expected - found: ',$name)"/>
    49964987      </xsl:call-template>
     
    50275018      <xsl:if test="not(//references//reference/seriesInfo[@name='Internet-Draft' and @value=$name])">
    50285019        <xsl:call-template name="warning">
    5029           <xsl:with-param name="inline" select="'no'"/>
    50305020          <xsl:with-param name="msg" select="concat('front matter mentions I-D ',$name,' for which there is no reference element')"/>
    50315021        </xsl:call-template>
     
    50355025      <xsl:if test="not(//references//reference/seriesInfo[@name='RFC' and @value=$name])">
    50365026        <xsl:call-template name="warning">
    5037           <xsl:with-param name="inline" select="'no'"/>
    50385027          <xsl:with-param name="msg" select="concat('front matter mentions RFC ',$name,' for which there is no reference element')"/>
    50395028        </xsl:call-template>
     
    51155104    <xsl:otherwise>
    51165105      <xsl:call-template name="warning">
    5117         <xsl:with-param name="inline" select="'no'"/>
    51185106        <xsl:with-param name="msg">internal link target for '<xsl:value-of select="."/>' does not exist.</xsl:with-param>
    51195107      </xsl:call-template>
     
    57015689    <xsl:if test="not(//reference/seriesInfo[@name='RFC' and (@value='2068' or @value='2616')])">
    57025690      <xsl:call-template name="warning">
    5703         <xsl:with-param name="inline">no</xsl:with-param>
    57045691        <xsl:with-param name="msg">document uses HTTP-style ABNF syntax, but doesn't reference RFC 2068 or 2616.</xsl:with-param>
    57055692      </xsl:call-template>
     
    57095696    <xsl:if test="not(//reference/seriesInfo[@name='RFC' and (@value='2234' or @value='4234' or @value='5234')])">
    57105697      <xsl:call-template name="warning">
    5711         <xsl:with-param name="inline">no</xsl:with-param>
    57125698        <xsl:with-param name="msg">document uses ABNF syntax, but doesn't reference RFC 2234, 4234 or 5234.</xsl:with-param>
    57135699      </xsl:call-template>
     
    59535939</xsl:template>
    59545940
     5941<xsl:template name="inline-warning">
     5942  <xsl:param name="msg"/>
     5943  <xsl:param name="msg2"/>
     5944  <xsl:call-template name="emit-message">
     5945    <xsl:with-param name="level">WARNING</xsl:with-param>
     5946    <xsl:with-param name="msg" select="$msg"/>
     5947    <xsl:with-param name="msg2" select="$msg2"/>
     5948    <xsl:with-param name="inline" select="'yes'"/>
     5949  </xsl:call-template>
     5950</xsl:template>
     5951
    59555952<xsl:template name="warning">
    59565953  <xsl:param name="msg"/>
     
    59615958    <xsl:with-param name="msg" select="$msg"/>
    59625959    <xsl:with-param name="msg2" select="$msg2"/>
    5963     <xsl:with-param name="inline" select="$inline"/>
     5960    <xsl:with-param name="inline" select="'no'"/>
    59645961  </xsl:call-template>
    59655962</xsl:template>
     
    60716068                  <xsl:otherwise>
    60726069                    <xsl:call-template name="warning">
    6073                       <xsl:with-param name="inline" select="'no'"/>
    60746070                      <xsl:with-param name="msg">Unknown align attribute on ttcol: <xsl:value-of select="$col/@align"/></xsl:with-param>                     
    60756071                    </xsl:call-template>
     
    63196315    <xsl:text>http://greenbytes.de/tech/webdav/rfc2629.xslt, </xsl:text>
    63206316    <!-- when RCS keyword substitution in place, add version info -->
    6321     <xsl:if test="contains('$Revision: 1.547 $',':')">
    6322       <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.547 $', 'Revision: '),'$','')),', ')" />
     6317    <xsl:if test="contains('$Revision: 1.550 $',':')">
     6318      <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.550 $', 'Revision: '),'$','')),', ')" />
    63236319    </xsl:if>
    6324     <xsl:if test="contains('$Date: 2011-04-17 09:42:41 $',':')">
    6325       <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2011-04-17 09:42:41 $', 'Date: '),'$','')),', ')" />
     6320    <xsl:if test="contains('$Date: 2011-05-30 14:02:12 $',':')">
     6321      <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2011-05-30 14:02:12 $', 'Date: '),'$','')),', ')" />
    63266322    </xsl:if>
    63276323    <xsl:value-of select="concat('XSLT vendor: ',system-property('xsl:vendor'),' ',system-property('xsl:vendor-url'))" />
     
    63386334    <xsl:if test="contains(.,',')">
    63396335      <xsl:call-template name="warning">
    6340         <xsl:with-param name="inline" select="'no'"/>
    63416336        <xsl:with-param name="msg">keyword element appears to contain a comma-separated list, split into multiple elements instead.</xsl:with-param>
    63426337      </xsl:call-template>
     
    64616456  <xsl:if test="$r!=@initials">
    64626457    <xsl:call-template name="warning">
    6463       <xsl:with-param name="inline" select="'no'"/>
    64646458      <xsl:with-param name="msg">@initials '<xsl:value-of select="@initials"/>': did you mean '<xsl:value-of select="$r"/>'?</xsl:with-param>
    64656459    </xsl:call-template>
     
    65276521  <xsl:if test="string-length($node) != string-length($text)">
    65286522    <xsl:call-template name="warning">
    6529       <xsl:with-param name="inline" select="'no'"/>
    65306523      <xsl:with-param name="msg">excessive whitespace in <xsl:value-of select="$name"/>: '<xsl:value-of select="$node"/>'</xsl:with-param>
    65316524    </xsl:call-template>
     
    65396532  <xsl:if test="string-length(.) != string-length($email) or contains($email,' ')">
    65406533    <xsl:call-template name="warning">
    6541       <xsl:with-param name="inline" select="'no'"/>
    65426534      <xsl:with-param name="msg">excessive whitespace in email address: '<xsl:value-of select="."/>'</xsl:with-param>
    65436535    </xsl:call-template>
     
    65486540      <xsl:when test="starts-with($email,'mailto:')">
    65496541        <xsl:call-template name="warning">
    6550           <xsl:with-param name="inline" select="'no'"/>
    65516542          <xsl:with-param name="msg">email should not include URI scheme: '<xsl:value-of select="."/>'</xsl:with-param>
    65526543        </xsl:call-template>
     
    65676558  <xsl:if test="string-length(.) != string-length($uri) or contains($uri,' ')">
    65686559    <xsl:call-template name="warning">
    6569       <xsl:with-param name="inline" select="'no'"/>
    65706560      <xsl:with-param name="msg">excessive whitespace in URI: '<xsl:value-of select="."/>'</xsl:with-param>
    65716561    </xsl:call-template>
     
    66686658          <xsl:call-template name="warning">
    66696659            <xsl:with-param name="msg">bad PI syntax: <xsl:value-of select="$str2"/></xsl:with-param>
    6670             <xsl:with-param name="inline" select="'no'"/>
    66716660          </xsl:call-template>
    66726661          <xsl:value-of select="$ret"/>
     
    66786667              <xsl:call-template name="warning">
    66796668                <xsl:with-param name="msg">bad PI value syntax: <xsl:value-of select="$remainder"/></xsl:with-param>
    6680                 <xsl:with-param name="inline" select="'no'"/>
    66816669              </xsl:call-template>
    66826670              <xsl:value-of select="$ret"/>
     
    66956683                  <xsl:call-template name="warning">
    66966684                    <xsl:with-param name="msg">pseudo-attribute value needs to be quoted: <xsl:value-of select="$rem"/></xsl:with-param>
    6697                     <xsl:with-param name="inline" select="'no'"/>
    66986685                  </xsl:call-template>
    66996686                  <xsl:value-of select="$ret"/>
     
    67026689                  <xsl:call-template name="warning">
    67036690                    <xsl:with-param name="msg">unmatched quote in: <xsl:value-of select="$rem2"/></xsl:with-param>
    6704                     <xsl:with-param name="inline" select="'no'"/>
    67056691                  </xsl:call-template>
    67066692                  <xsl:value-of select="$ret"/>
     
    67156701                      <xsl:when test="$attrname='authors-section'"/>
    67166702                      <xsl:when test="$attrname='duplex'"/>
     6703                      <xsl:when test="$attrname='include-index'"/>
    67176704                      <xsl:when test="$attrname='include-references-in-index'"/>
    67186705                      <xsl:when test="$attrname='justification'"/>
     
    67246711                        <xsl:call-template name="warning">
    67256712                          <xsl:with-param name="msg">unsupported rfc-ext pseudo-attribute '<xsl:value-of select="$attrname"/>'</xsl:with-param>
    6726                           <xsl:with-param name="inline" select="'no'"/>
    67276713                        </xsl:call-template>
    67286714                      </xsl:otherwise>
     
    67356721                        <xsl:call-template name="warning">
    67366722                          <xsl:with-param name="msg">the rfc include pseudo-attribute is not supported by this processor, see http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset for help.</xsl:with-param>
    6737                           <xsl:with-param name="inline" select="'no'"/>
    67386723                        </xsl:call-template>
    67396724                      </xsl:when>
     
    67576742                        <xsl:call-template name="warning">
    67586743                          <xsl:with-param name="msg">duplicate pseudo-attribute <xsl:value-of select="$attr"/>, overwriting value <xsl:value-of select="$ret"/></xsl:with-param>
    6759                           <xsl:with-param name="inline" select="'no'"/>
    67606744                        </xsl:call-template>
    67616745                      </xsl:if>
     
    69486932    <xsl:when test="$current-year!='' and $may-default-dates!='yes'">
    69496933      <xsl:call-template name="warning">
    6950         <xsl:with-param name="inline" select="'no'"/>
    69516934        <xsl:with-param name="msg" select="$may-default-dates"/>
    69526935      </xsl:call-template>
     
    69726955    <xsl:when test="$current-month!='' and $may-default-dates!='yes'">
    69736956      <xsl:call-template name="warning">
    6974         <xsl:with-param name="inline" select="'no'"/>
    69756957        <xsl:with-param name="msg" select="$may-default-dates"/>
    69766958      </xsl:call-template>
     
    70176999    <xsl:otherwise>00</xsl:otherwise>
    70187000  </xsl:choose>
    7019 
    70207001</xsl:param>
    70217002
     7003<!-- simple validation support -->
     7004
     7005<xsl:template match="*" mode="validate">
     7006  <xsl:apply-templates select="@*|*" mode="validate"/>
     7007</xsl:template>
     7008<xsl:template match="@*" mode="validate"/>
     7009
     7010<xsl:template name="warninvalid">
     7011  <xsl:variable name="pname">
     7012    <xsl:if test="namespace-uri(..)!=''">
     7013      <xsl:value-of select="concat('{',namespace-uri(..),'}')"/>
     7014    </xsl:if>
     7015    <xsl:value-of select="local-name(..)"/>
     7016  </xsl:variable>
     7017  <xsl:variable name="cname">
     7018    <xsl:if test="namespace-uri(.)!=''">
     7019      <xsl:value-of select="concat('{',namespace-uri(.),'}')"/>
     7020    </xsl:if>
     7021    <xsl:value-of select="local-name(.)"/>
     7022  </xsl:variable>
     7023  <xsl:call-template name="warning">
     7024    <xsl:with-param name="msg" select="concat($cname,' not allowed inside ',$pname)"/>
     7025  </xsl:call-template>
     7026</xsl:template>
     7027
     7028<!-- figure element -->
     7029<xsl:template match="figure/artwork | figure/ed:replace/ed:*/artwork" mode="validate" priority="9">
     7030  <xsl:apply-templates select="@*|*" mode="validate"/>
     7031</xsl:template>
     7032<xsl:template match="artwork" mode="validate">
     7033  <xsl:call-template name="warninvalid"/>
     7034  <xsl:apply-templates select="@*|*" mode="validate"/>
     7035</xsl:template>
     7036
     7037<!-- list element -->
     7038<xsl:template match="t/list | t/ed:replace/ed:*/list" mode="validate" priority="9">
     7039  <xsl:apply-templates select="@*|*" mode="validate"/>
     7040</xsl:template>
     7041<xsl:template match="list" mode="validate">
     7042  <xsl:call-template name="warninvalid"/>
     7043  <xsl:apply-templates select="@*|*" mode="validate"/>
     7044</xsl:template>
     7045
     7046<!-- t element -->
     7047<xsl:template match="abstract/t | abstract/ed:replace/ed:*/t |
     7048                     list/t | list/ed:replace/ed:*/t |
     7049                     note/t | note/ed:replace/ed:*/t |
     7050                     section/t | section/ed:replace/ed:*/t |
     7051                     x:blockquote/t | x:blockquote/ed:replace/ed:*/t |
     7052                     x:note/t | x:note/ed:replace/ed:*/t |
     7053                     x:lt/t | x:lt/ed:replace/ed:*/t" mode="validate" priority="9">
     7054  <xsl:apply-templates select="@*|*" mode="validate"/>
     7055</xsl:template>
     7056<xsl:template match="t" mode="validate">
     7057  <xsl:call-template name="warninvalid"/>
     7058  <xsl:apply-templates select="@*|*" mode="validate"/>
     7059</xsl:template>
     7060
    70227061</xsl:transform>
Note: See TracChangeset for help on using the changeset viewer.