Ignore:
Timestamp:
Jul 14, 2012, 8:07:57 AM (7 years ago)
Author:
julian.reschke@…
Message:

Remove ABNF diagnostics for known to be non-referenced productions (header field names)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • draft-ietf-httpbis/latest/abnf2xml2rfc.xslt

    r1711 r1773  
    1717  <xsl:variable name="lines" select="$all-lines[normalize-space(.)!='']"/>
    1818 
    19   <section title="Collected ABNF" anchor="collected.abnf">
     19  <xsl:variable name="generated"><section title="Collected ABNF" anchor="collected.abnf">
    2020    <xsl:text>&#10;</xsl:text>
    2121    <figure>
     
    5858    <xsl:text>&#10;</xsl:text>
    5959   
    60     <figure>
    61       <preamble>ABNF diagnostics:</preamble>
    62       <artwork type="inline">
    63         <xsl:text>&#10;</xsl:text>
    64         <xsl:for-each select="$lines[substring(.,1,2)='; ']">
    65           <xsl:value-of select="."/>
     60    <xsl:variable name="diags">
     61      <xsl:for-each select="$lines[substring(.,1,2)='; ']">
     62        <xsl:variable name="prod" select="substring-before(substring-after(.,'; '),' defined but not used')"/>
     63        <xsl:choose>
     64          <xsl:when test="$prod!='' and $src//iref[@item='Header Fields' and @subitem=$prod]">
     65            <!-- header field; expected not to be reference -->
     66          </xsl:when>
     67          <xsl:otherwise>
     68            <xsl:value-of select="."/>
     69            <xsl:text>&#10;</xsl:text>
     70          </xsl:otherwise>
     71        </xsl:choose>
     72      </xsl:for-each>
     73    </xsl:variable>
     74   
     75    <xsl:if test="$diags!=''">
     76      <figure>
     77        <preamble>ABNF diagnostics:</preamble>
     78        <artwork type="inline">
    6679          <xsl:text>&#10;</xsl:text>
    67         </xsl:for-each>
    68     </artwork></figure>
    69   </section>
     80          <xsl:value-of select="$diags"/>
     81      </artwork></figure>
     82    </xsl:if>
     83  </section></xsl:variable>
     84
     85  <xsl:copy-of select="$generated"/>
    7086
    7187  <!-- check whether it's up-to-date... -->
     
    7692  </xsl:variable>
    7793 
    78   <xsl:if test="not(//section[@anchor='collected.abnf']) or normalize-space($src) != normalize-space($collected)">
     94  <xsl:if test="not(//section[@anchor='collected.abnf']) or normalize-space($src) != normalize-space($generated)">
    7995    <xsl:message>WARNING: appendix contained inside source document needs to be updated</xsl:message>
    8096    <xsl:call-template name="showdiff">
    8197      <xsl:with-param name="actual" select="normalize-space($src)"/>
    82       <xsl:with-param name="expected" select="normalize-space($collected)"/>
     98      <xsl:with-param name="expected" select="normalize-space($generated)"/>
    8399    </xsl:call-template>
    84100  </xsl:if>
Note: See TracChangeset for help on using the changeset viewer.