source: draft-ietf-httpbis/latest/extract-status-code-defs.xslt @ 288

Last change on this file since 288 was 288, checked in by julian.reschke@…, 11 years ago

Add checking of consistency of auto-generated tables (related to #72)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2               xmlns:x="http://purl.org/net/xml2rfc/ext"
3               xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
4               version="1.0"
5               exclude-result-prefixes="rdf x"
6>
7
8<xsl:output indent="yes" omit-xml-declaration="yes"/>
9
10<xsl:output indent="yes" omit-xml-declaration="yes"/>
11
12<xsl:template match="/">
13  <xsl:variable name="table">
14    <texttable align="left" suppress-title="true" anchor="iana.status.code.registration.table">
15      <ttcol>Value</ttcol>
16      <ttcol>Description</ttcol>
17      <ttcol>Reference</ttcol>
18      <xsl:apply-templates select="//section[iref/@item='Status Codes']">
19        <xsl:sort select="iref[@item='Status Codes']/@subitem"/>
20      </xsl:apply-templates>
21    </texttable>
22    <xsl:text>&#10;</xsl:text>
23  </xsl:variable>
24
25  <xsl:comment>AUTOGENERATED FROM extract-status-code-defs.xslt, do not edit manually</xsl:comment>
26  <xsl:text>&#10;</xsl:text>
27  <xsl:copy-of select="$table"/>
28  <xsl:comment>(END)</xsl:comment>
29  <xsl:text>&#10;</xsl:text>
30
31  <!-- check against current version -->
32  <xsl:variable name="oldtable" select="//texttable[@anchor='iana.status.code.registration.table']" />
33
34  <xsl:if test="string($table//ttcol | $table//c) != string($oldtable//ttcol | $oldtable//c)">
35    <xsl:message>WARNING: table contained inside source document needs to be updated!</xsl:message>
36  </xsl:if>
37
38</xsl:template>
39
40<xsl:template match="section">
41  <xsl:variable name="text" select="iref[@item='Status Codes']/@subitem"/>
42  <xsl:text>&#10;</xsl:text>
43  <c><xsl:value-of select="substring-before($text,' ')"/></c>
44  <c><xsl:value-of select="substring($text,2+string-length(substring-before($text,' ')))"/></c>
45  <c><xref target="{@anchor}"/></c>
46</xsl:template>
47
48</xsl:transform>
Note: See TracBrowser for help on using the repository browser.