Changeset 832 for rfc2629xslt/rfc2629.xslt
- Timestamp:
- 01/07/10 13:30:11 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rfc2629xslt/rfc2629.xslt
r799 r832 344 344 <xsl:variable name="lcase" select="'abcdefghijklmnopqrstuvwxyz'" /> 345 345 <xsl:variable name="ucase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> 346 <xsl:variable name="digits" select="'0123456789'" /> 346 347 347 348 <!-- build help keys for indices --> … … 1014 1015 <xsl:apply-templates select="title"/> 1015 1016 <xsl:if test="/rfc/@docName"> 1017 <xsl:variable name="docname" select="/rfc/@docName"/> 1018 1016 1019 <br/> 1017 <span class="filename"><xsl:value-of select=" /rfc/@docName"/></span>1020 <span class="filename"><xsl:value-of select="$docname"/></span> 1018 1021 1019 <xsl:if test="contains(/rfc/@docName,'.')"> 1022 <xsl:variable name="docname-noext"> 1023 <xsl:choose> 1024 <xsl:when test="contains($docname,'.')"> 1025 <xsl:call-template name="warning"> 1026 <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> 1027 <xsl:with-param name="inline" select="'no'"/> 1028 </xsl:call-template> 1029 <xsl:value-of select="substring-before($docname,'.')"/> 1030 </xsl:when> 1031 <xsl:otherwise> 1032 <xsl:value-of select="$docname"/> 1033 </xsl:otherwise> 1034 </xsl:choose> 1035 </xsl:variable> 1036 1037 <!-- more name checks --> 1038 <xsl:variable name="offending" select="translate($docname,concat($lcase,$digits,'-.'),'')"/> 1039 <xsl:if test="$offending != ''"> 1020 1040 <xsl:call-template name="warning"> 1021 <xsl:with-param name="msg">The @docName attribute should contain the base name, not the filename (thus no file extension).</xsl:with-param> 1041 <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> 1042 <xsl:with-param name="inline" select="'no'"/> 1022 1043 </xsl:call-template> 1023 1044 </xsl:if> 1045 1046 1047 <xsl:if test="contains($docname,'--')"> 1048 <xsl:call-template name="warning"> 1049 <xsl:with-param name="msg">The @docName attribute '<xsl:value-of select="$docname"/>' should not contain the character sequence '--'.</xsl:with-param> 1050 <xsl:with-param name="inline" select="'no'"/> 1051 </xsl:call-template> 1052 </xsl:if> 1053 1054 <xsl:if test="not(starts-with($docname,'draft-'))"> 1055 <xsl:call-template name="warning"> 1056 <xsl:with-param name="msg">The @docName attribute '<xsl:value-of select="$docname"/>' should start with 'draft-'.</xsl:with-param> 1057 <xsl:with-param name="inline" select="'no'"/> 1058 </xsl:call-template> 1059 </xsl:if> 1060 1061 <!-- sequence number --> 1062 <xsl:variable name="seq"> 1063 <xsl:choose> 1064 <xsl:when test="substring($docname-noext,string-length($docname-noext) + 1 - string-length('-latest'))='-latest'">latest</xsl:when> 1065 <xsl:when test="substring($docname-noext,string-length($docname-noext) - 2, 1)='-'"><xsl:value-of select="substring($docname-noext,string-length($docname-noext)-1)"/></xsl:when> 1066 <xsl:otherwise/> 1067 </xsl:choose> 1068 </xsl:variable> 1069 1070 <xsl:if test="$seq='' or ($seq!='latest' and translate($seq,$digits,'')!='')"> 1071 <xsl:call-template name="warning"> 1072 <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> 1073 <xsl:with-param name="inline" select="'no'"/> 1074 </xsl:call-template> 1075 </xsl:if> 1076 1077 <xsl:if test="string-length($docname)-string-length($seq) > 50"> 1078 <xsl:call-template name="warning"> 1079 <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> 1080 <xsl:with-param name="inline" select="'no'"/> 1081 </xsl:call-template> 1082 </xsl:if> 1083 1024 1084 </xsl:if> 1025 1085 </p> … … 1491 1551 <xsl:call-template name="format-initials"/> 1492 1552 </xsl:variable> 1553 <xsl:variable name="truncated-initials" select="concat(substring-before($initials,'.'),'.')"/> 1493 1554 1494 1555 <xsl:choose> … … 1498 1559 <xsl:choose> 1499 1560 <xsl:when test="position()=last() and position()!=1"> 1500 <xsl:value-of select="concat($ initials,' ',@surname)" />1561 <xsl:value-of select="concat($truncated-initials,' ',@surname)" /> 1501 1562 </xsl:when> 1502 1563 <xsl:otherwise> 1503 <xsl:value-of select="concat(@surname,', ',$ initials)" />1564 <xsl:value-of select="concat(@surname,', ',$truncated-initials)" /> 1504 1565 </xsl:otherwise> 1505 1566 </xsl:choose> … … 2660 2721 <xsl:call-template name="format-initials"/> 2661 2722 </xsl:variable> 2723 <xsl:variable name="truncated-initials" select="concat(substring-before($initials,'.'),'.')"/> 2662 2724 <xsl:if test="@surname"> 2663 2725 <myns:item> 2664 <xsl:value-of select="concat($ initials,' ',@surname)" />2726 <xsl:value-of select="concat($truncated-initials,' ',@surname)" /> 2665 2727 <xsl:if test="@role"> 2666 2728 <xsl:choose> … … 6118 6180 <xsl:text>http://greenbytes.de/tech/webdav/rfc2629.xslt, </xsl:text> 6119 6181 <!-- when RCS keyword substitution in place, add version info --> 6120 <xsl:if test="contains('$Revision: 1.51 7$',':')">6121 <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.51 7$', 'Revision: '),'$','')),', ')" />6182 <xsl:if test="contains('$Revision: 1.518 $',':')"> 6183 <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.518 $', 'Revision: '),'$','')),', ')" /> 6122 6184 </xsl:if> 6123 <xsl:if test="contains('$Date: 2010-0 3-31 18:24:38$',':')">6124 <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2010-0 3-31 18:24:38$', 'Date: '),'$','')),', ')" />6185 <xsl:if test="contains('$Date: 2010-06-27 12:07:31 $',':')"> 6186 <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2010-06-27 12:07:31 $', 'Date: '),'$','')),', ')" /> 6125 6187 </xsl:if> 6126 6188 <xsl:value-of select="concat('XSLT vendor: ',system-property('xsl:vendor'),' ',system-property('xsl:vendor-url'))" /> … … 6252 6314 <!-- reformat contents of author/@initials --> 6253 6315 <xsl:template name="format-initials"> 6316 <xsl:variable name="r"> 6317 <xsl:call-template name="t-format-initials"> 6318 <xsl:with-param name="remainder" select="normalize-space(@initials)"/> 6319 </xsl:call-template> 6320 </xsl:variable> 6321 6322 <xsl:if test="$r!=@initials"> 6323 <xsl:call-template name="warning"> 6324 <xsl:with-param name="inline" select="'no'"/> 6325 <xsl:with-param name="msg">@initials '<xsl:value-of select="@initials"/>': did you mean '<xsl:value-of select="$r"/>'?</xsl:with-param> 6326 </xsl:call-template> 6327 </xsl:if> 6328 6329 <xsl:value-of select="$r"/> 6330 </xsl:template> 6331 6332 <xsl:template name="t-format-initials"> 6333 <xsl:param name="have"/> 6334 <xsl:param name="remainder"/> 6335 6336 <xsl:variable name="first" select="substring($remainder,1,1)"/> 6337 <xsl:variable name="prev" select="substring($have,string-length($have))"/> 6338 6339 <!--<xsl:message> 6340 have: <xsl:value-of select="$have"/> 6341 remainder: <xsl:value-of select="$remainder"/> 6342 first: <xsl:value-of select="$first"/> 6343 prev: <xsl:value-of select="$prev"/> 6344 </xsl:message>--> 6345 6254 6346 <xsl:choose> 6255 <xsl:when test="string-length(@initials)=1"> 6256 <xsl:value-of select="concat(@initials,'.')"/> 6257 </xsl:when> 6347 <xsl:when test="$remainder='' and $prev!='.'"> 6348 <xsl:value-of select="concat($have,'.')"/> 6349 </xsl:when> 6350 <xsl:when test="$remainder=''"> 6351 <xsl:value-of select="$have"/> 6352 </xsl:when> 6353 <xsl:when test="$prev='.' and $first='.'"> 6354 <!-- repeating dots --> 6355 <xsl:call-template name="t-format-initials"> 6356 <xsl:with-param name="have" select="$have"/> 6357 <xsl:with-param name="remainder" select="substring($remainder,2)"/> 6358 </xsl:call-template> 6359 </xsl:when> 6360 <!-- missing dot before '-' --> 6361 <!-- <xsl:when test="$prev!='.' and $first='-'"> 6362 <xsl:call-template name="t-format-initials"> 6363 <xsl:with-param name="have" select="concat($have,'.-')"/> 6364 <xsl:with-param name="remainder" select="substring($remainder,2)"/> 6365 </xsl:call-template> 6366 </xsl:when>--> 6367 <!-- missing space after '.' --> 6368 <!-- <xsl:when test="$prev='.' and $first!=' '"> 6369 <xsl:call-template name="t-format-initials"> 6370 <xsl:with-param name="have" select="concat($have,' ',$first)"/> 6371 <xsl:with-param name="remainder" select="substring($remainder,2)"/> 6372 </xsl:call-template> 6373 </xsl:when>--> 6258 6374 <xsl:otherwise> 6259 <xsl:value-of select="@initials"/> 6375 <xsl:call-template name="t-format-initials"> 6376 <xsl:with-param name="have" select="concat($have,$first)"/> 6377 <xsl:with-param name="remainder" select="substring($remainder,2)"/> 6378 </xsl:call-template> 6260 6379 </xsl:otherwise> 6261 6380 </xsl:choose> 6381 6262 6382 </xsl:template> 6263 6383
Note: See TracChangeset
for help on using the changeset viewer.