Changeset 1303 for rfc2629xslt/samples/rfc2629.xslt
- Timestamp:
- 01/06/11 09:03:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rfc2629xslt/samples/rfc2629.xslt
r1276 r1303 231 231 </xsl:param> 232 232 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 233 243 <!-- extension for excluding DCMI properties in meta tag (RFC2731) --> 234 244 … … 425 435 <xsl:call-template name="warning"> 426 436 <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'"/>428 437 </xsl:call-template> 429 438 </xsl:if> … … 561 570 562 571 <!-- 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'" /> 564 573 565 574 <!-- does the document contain edits? --> … … 737 746 <xsl:if test="string-length($content) > 69 + $indent"> 738 747 <xsl:call-template name="warning"> 739 <xsl:with-param name="inline" select="'no'"/>740 748 <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> 741 749 </xsl:call-template> … … 753 761 <xsl:if test="string-length($start) > $max"> 754 762 <xsl:call-template name="warning"> 755 <xsl:with-param name="inline" select="'no'"/>756 763 <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> 757 764 </xsl:call-template> … … 1063 1070 <xsl:call-template name="warning"> 1064 1071 <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'"/>1066 1072 </xsl:call-template> 1067 1073 <xsl:value-of select="substring-before($docname,'.')"/> … … 1078 1084 <xsl:call-template name="warning"> 1079 1085 <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'"/>1081 1086 </xsl:call-template> 1082 1087 </xsl:if> … … 1086 1091 <xsl:call-template name="warning"> 1087 1092 <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'"/>1089 1093 </xsl:call-template> 1090 1094 </xsl:if> … … 1093 1097 <xsl:call-template name="warning"> 1094 1098 <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'"/>1096 1099 </xsl:call-template> 1097 1100 </xsl:if> … … 1109 1112 <xsl:call-template name="warning"> 1110 1113 <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'"/>1112 1114 </xsl:call-template> 1113 1115 </xsl:if> … … 1116 1118 <xsl:call-template name="warning"> 1117 1119 <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'"/>1119 1120 </xsl:call-template> 1120 1121 </xsl:if> … … 1530 1531 <xsl:if test="not(ancestor::ed:del) and not(key('xref-item',$anchor))"> 1531 1532 <xsl:call-template name="warning"> 1532 <xsl:with-param name="inline" select="'no'"/>1533 1533 <xsl:with-param name="msg">unused reference '<xsl:value-of select="@anchor"/>'</xsl:with-param> 1534 1534 </xsl:call-template> … … 1548 1548 <xsl:if test="$tst=''"> 1549 1549 <xsl:call-template name="warning"> 1550 <xsl:with-param name="inline" select="'no'"/>1551 1550 <xsl:with-param name="msg">all references to the normative reference '<xsl:value-of select="@anchor"/>' appear to be informative</xsl:with-param> 1552 1551 </xsl:call-template> … … 1685 1684 <xsl:if test="(@name='BCP' or @name='FYI' or @name='STD') and preceding-sibling::seriesInfo[@name='RFC']"> 1686 1685 <xsl:call-template name="warning"> 1687 <xsl:with-param name="inline" select="'no'"/>1688 1686 <xsl:with-param name="msg">RFC number preceding <xsl:value-of select="@name"/> number in reference '<xsl:value-of select="../@anchor"/>'</xsl:with-param> 1689 1687 </xsl:call-template> … … 1701 1699 <xsl:if test="string(number(front/date/@year)) = 'NaN'"> 1702 1700 <xsl:call-template name="warning"> 1703 <xsl:with-param name="inline" select="'no'"/>1704 1701 <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> 1705 1702 </xsl:call-template> … … 1953 1950 <xsl:template match="t"> 1954 1951 <xsl:if test="preceding-sibling::section or preceding-sibling::appendix"> 1955 <xsl:call-template name=" warning">1952 <xsl:call-template name="inline-warning"> 1956 1953 <xsl:with-param name="msg">The paragraph below is misplaced; maybe a section is closed in the wrong place: </xsl:with-param> 1957 1954 <xsl:with-param name="msg2"><xsl:value-of select="."/></xsl:with-param> … … 2019 2016 <xsl:if test="@abbrev and string-length(@abbrev) > 40"> 2020 2017 <xsl:call-template name="warning"> 2021 <xsl:with-param name="inline" select="'no'"/>2022 2018 <xsl:with-param name="msg">title/@abbrev too long (max 40 characters)</xsl:with-param> 2023 2019 </xsl:call-template> … … 2026 2022 <xsl:if test="string-length(.) > 40 and (not(@abbrev) or @abbrev='')"> 2027 2023 <xsl:call-template name="warning"> 2028 <xsl:with-param name="inline" select="'no'"/>2029 2024 <xsl:with-param name="msg">title too long, should supply title/@abbrev attribute with less than 40 characters</xsl:with-param> 2030 2025 </xsl:call-template> … … 2060 2055 <xsl:if test="self::appendix"> 2061 2056 <xsl:call-template name="warning"> 2062 <xsl:with-param name="inline" select="'no'"/>2063 2057 <xsl:with-param name="msg">The "appendix" element is deprecated, use "section" inside "back" instead.</xsl:with-param> 2064 2058 </xsl:call-template> … … 2294 2288 <xsl:if test="not($r-is-normative)"> 2295 2289 <xsl:call-template name="warning"> 2296 <xsl:with-param name="inline" select="'no'"/>2297 2290 <xsl:with-param name="msg" select="concat('Potentially normative reference to ',@target,' not referenced normatively')"/> 2298 2291 </xsl:call-template> … … 2461 2454 <xsl:for-each select="$xref"> 2462 2455 <xsl:call-template name="warning"> 2463 <xsl:with-param name="inline" select="'no'"/>2464 2456 <xsl:with-param name="msg" select="concat('Potentially normative reference to ',$xref/@target,' not referenced normatively')"/> 2465 2457 </xsl:call-template> … … 2669 2661 2670 2662 <xsl:template match="/"> 2663 <xsl:apply-templates select="*" mode="validate"/> 2671 2664 <xsl:apply-templates select="*" /> 2672 2665 </xsl:template> … … 2814 2807 <xsl:call-template name="warning"> 2815 2808 <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'"/>2817 2809 </xsl:call-template> 2818 2810 </xsl:if> … … 4992 4984 <xsl:value-of select="$name"/> 4993 4985 <xsl:call-template name="warning"> 4994 <xsl:with-param name="inline" select="'no'"/>4995 4986 <xsl:with-param name="msg" select="concat('In metadata obsoletes/updates, RFC number of draft name is expected - found: ',$name)"/> 4996 4987 </xsl:call-template> … … 5027 5018 <xsl:if test="not(//references//reference/seriesInfo[@name='Internet-Draft' and @value=$name])"> 5028 5019 <xsl:call-template name="warning"> 5029 <xsl:with-param name="inline" select="'no'"/>5030 5020 <xsl:with-param name="msg" select="concat('front matter mentions I-D ',$name,' for which there is no reference element')"/> 5031 5021 </xsl:call-template> … … 5035 5025 <xsl:if test="not(//references//reference/seriesInfo[@name='RFC' and @value=$name])"> 5036 5026 <xsl:call-template name="warning"> 5037 <xsl:with-param name="inline" select="'no'"/>5038 5027 <xsl:with-param name="msg" select="concat('front matter mentions RFC ',$name,' for which there is no reference element')"/> 5039 5028 </xsl:call-template> … … 5115 5104 <xsl:otherwise> 5116 5105 <xsl:call-template name="warning"> 5117 <xsl:with-param name="inline" select="'no'"/>5118 5106 <xsl:with-param name="msg">internal link target for '<xsl:value-of select="."/>' does not exist.</xsl:with-param> 5119 5107 </xsl:call-template> … … 5701 5689 <xsl:if test="not(//reference/seriesInfo[@name='RFC' and (@value='2068' or @value='2616')])"> 5702 5690 <xsl:call-template name="warning"> 5703 <xsl:with-param name="inline">no</xsl:with-param>5704 5691 <xsl:with-param name="msg">document uses HTTP-style ABNF syntax, but doesn't reference RFC 2068 or 2616.</xsl:with-param> 5705 5692 </xsl:call-template> … … 5709 5696 <xsl:if test="not(//reference/seriesInfo[@name='RFC' and (@value='2234' or @value='4234' or @value='5234')])"> 5710 5697 <xsl:call-template name="warning"> 5711 <xsl:with-param name="inline">no</xsl:with-param>5712 5698 <xsl:with-param name="msg">document uses ABNF syntax, but doesn't reference RFC 2234, 4234 or 5234.</xsl:with-param> 5713 5699 </xsl:call-template> … … 5953 5939 </xsl:template> 5954 5940 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 5955 5952 <xsl:template name="warning"> 5956 5953 <xsl:param name="msg"/> … … 5961 5958 <xsl:with-param name="msg" select="$msg"/> 5962 5959 <xsl:with-param name="msg2" select="$msg2"/> 5963 <xsl:with-param name="inline" select=" $inline"/>5960 <xsl:with-param name="inline" select="'no'"/> 5964 5961 </xsl:call-template> 5965 5962 </xsl:template> … … 6071 6068 <xsl:otherwise> 6072 6069 <xsl:call-template name="warning"> 6073 <xsl:with-param name="inline" select="'no'"/>6074 6070 <xsl:with-param name="msg">Unknown align attribute on ttcol: <xsl:value-of select="$col/@align"/></xsl:with-param> 6075 6071 </xsl:call-template> … … 6319 6315 <xsl:text>http://greenbytes.de/tech/webdav/rfc2629.xslt, </xsl:text> 6320 6316 <!-- when RCS keyword substitution in place, add version info --> 6321 <xsl:if test="contains('$Revision: 1.5 47$',':')">6322 <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.5 47$', '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: '),'$','')),', ')" /> 6323 6319 </xsl:if> 6324 <xsl:if test="contains('$Date: 2011-0 4-17 09:42:41$',':')">6325 <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2011-0 4-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: '),'$','')),', ')" /> 6326 6322 </xsl:if> 6327 6323 <xsl:value-of select="concat('XSLT vendor: ',system-property('xsl:vendor'),' ',system-property('xsl:vendor-url'))" /> … … 6338 6334 <xsl:if test="contains(.,',')"> 6339 6335 <xsl:call-template name="warning"> 6340 <xsl:with-param name="inline" select="'no'"/>6341 6336 <xsl:with-param name="msg">keyword element appears to contain a comma-separated list, split into multiple elements instead.</xsl:with-param> 6342 6337 </xsl:call-template> … … 6461 6456 <xsl:if test="$r!=@initials"> 6462 6457 <xsl:call-template name="warning"> 6463 <xsl:with-param name="inline" select="'no'"/>6464 6458 <xsl:with-param name="msg">@initials '<xsl:value-of select="@initials"/>': did you mean '<xsl:value-of select="$r"/>'?</xsl:with-param> 6465 6459 </xsl:call-template> … … 6527 6521 <xsl:if test="string-length($node) != string-length($text)"> 6528 6522 <xsl:call-template name="warning"> 6529 <xsl:with-param name="inline" select="'no'"/>6530 6523 <xsl:with-param name="msg">excessive whitespace in <xsl:value-of select="$name"/>: '<xsl:value-of select="$node"/>'</xsl:with-param> 6531 6524 </xsl:call-template> … … 6539 6532 <xsl:if test="string-length(.) != string-length($email) or contains($email,' ')"> 6540 6533 <xsl:call-template name="warning"> 6541 <xsl:with-param name="inline" select="'no'"/>6542 6534 <xsl:with-param name="msg">excessive whitespace in email address: '<xsl:value-of select="."/>'</xsl:with-param> 6543 6535 </xsl:call-template> … … 6548 6540 <xsl:when test="starts-with($email,'mailto:')"> 6549 6541 <xsl:call-template name="warning"> 6550 <xsl:with-param name="inline" select="'no'"/>6551 6542 <xsl:with-param name="msg">email should not include URI scheme: '<xsl:value-of select="."/>'</xsl:with-param> 6552 6543 </xsl:call-template> … … 6567 6558 <xsl:if test="string-length(.) != string-length($uri) or contains($uri,' ')"> 6568 6559 <xsl:call-template name="warning"> 6569 <xsl:with-param name="inline" select="'no'"/>6570 6560 <xsl:with-param name="msg">excessive whitespace in URI: '<xsl:value-of select="."/>'</xsl:with-param> 6571 6561 </xsl:call-template> … … 6668 6658 <xsl:call-template name="warning"> 6669 6659 <xsl:with-param name="msg">bad PI syntax: <xsl:value-of select="$str2"/></xsl:with-param> 6670 <xsl:with-param name="inline" select="'no'"/>6671 6660 </xsl:call-template> 6672 6661 <xsl:value-of select="$ret"/> … … 6678 6667 <xsl:call-template name="warning"> 6679 6668 <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'"/>6681 6669 </xsl:call-template> 6682 6670 <xsl:value-of select="$ret"/> … … 6695 6683 <xsl:call-template name="warning"> 6696 6684 <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'"/>6698 6685 </xsl:call-template> 6699 6686 <xsl:value-of select="$ret"/> … … 6702 6689 <xsl:call-template name="warning"> 6703 6690 <xsl:with-param name="msg">unmatched quote in: <xsl:value-of select="$rem2"/></xsl:with-param> 6704 <xsl:with-param name="inline" select="'no'"/>6705 6691 </xsl:call-template> 6706 6692 <xsl:value-of select="$ret"/> … … 6715 6701 <xsl:when test="$attrname='authors-section'"/> 6716 6702 <xsl:when test="$attrname='duplex'"/> 6703 <xsl:when test="$attrname='include-index'"/> 6717 6704 <xsl:when test="$attrname='include-references-in-index'"/> 6718 6705 <xsl:when test="$attrname='justification'"/> … … 6724 6711 <xsl:call-template name="warning"> 6725 6712 <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'"/>6727 6713 </xsl:call-template> 6728 6714 </xsl:otherwise> … … 6735 6721 <xsl:call-template name="warning"> 6736 6722 <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'"/>6738 6723 </xsl:call-template> 6739 6724 </xsl:when> … … 6757 6742 <xsl:call-template name="warning"> 6758 6743 <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'"/>6760 6744 </xsl:call-template> 6761 6745 </xsl:if> … … 6948 6932 <xsl:when test="$current-year!='' and $may-default-dates!='yes'"> 6949 6933 <xsl:call-template name="warning"> 6950 <xsl:with-param name="inline" select="'no'"/>6951 6934 <xsl:with-param name="msg" select="$may-default-dates"/> 6952 6935 </xsl:call-template> … … 6972 6955 <xsl:when test="$current-month!='' and $may-default-dates!='yes'"> 6973 6956 <xsl:call-template name="warning"> 6974 <xsl:with-param name="inline" select="'no'"/>6975 6957 <xsl:with-param name="msg" select="$may-default-dates"/> 6976 6958 </xsl:call-template> … … 7017 6999 <xsl:otherwise>00</xsl:otherwise> 7018 7000 </xsl:choose> 7019 7020 7001 </xsl:param> 7021 7002 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 7022 7061 </xsl:transform>
Note: See TracChangeset
for help on using the changeset viewer.