source: draft-ietf-httpbis/latest-roy/extract-header-defs.xslt @ 437

Last change on this file since 437 was 291, checked in by julian.reschke@…, 15 years ago

markup Mime-Version as header (affects IANA table), fix table consistency check (related to #40)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.7 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:template match="/">
11  <xsl:variable name="table">
12    <texttable align="left" suppress-title="true" anchor="iana.header.registration.table">
13      <ttcol>Header Field Name</ttcol>
14      <ttcol>Protocol</ttcol>
15      <ttcol>Status</ttcol>
16      <ttcol>Reference</ttcol>
17      <xsl:text>&#10;</xsl:text>
18      <xsl:apply-templates select="//section[iref/@item='Headers']">
19        <xsl:sort select="iref[@item='Headers']/@subitem"/>
20      </xsl:apply-templates>
21    </texttable>
22    <xsl:text>&#10;</xsl:text>
23  </xsl:variable>
24
25  <xsl:comment>AUTOGENERATED FROM extract-header-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.header.registration.table']" />
33
34  <xsl:variable name="s">
35    <xsl:apply-templates select="$table//texttable" mode="tostring"/>
36  </xsl:variable>
37 
38  <xsl:variable name="s1">
39    <xsl:apply-templates select="$oldtable" mode="tostring"/>
40  </xsl:variable>
41
42  <xsl:if test="$s != $s1">
43    <xsl:message>WARNING: table contained inside source document needs to be updated</xsl:message>
44    <xsl:message><xsl:value-of select="$s"/></xsl:message>
45    <xsl:message><xsl:value-of select="$s1"/></xsl:message>
46  </xsl:if>
47
48</xsl:template>
49
50<xsl:template match="*" mode="tostring">
51  <xsl:text>&lt;</xsl:text>
52  <xsl:value-of select="name()"/>
53  <xsl:for-each select="@*">
54    <xsl:sort select="name()"/>
55    <xsl:text> </xsl:text>
56    <xsl:value-of select="name()"/>
57    <xsl:text>=</xsl:text>
58    <xsl:value-of select="."/>
59  </xsl:for-each>
60  <xsl:text>&gt;</xsl:text>
61 
62  <xsl:apply-templates select="node()" mode="tostring"/>
63 
64  <xsl:text>&lt;/</xsl:text>
65  <xsl:value-of select="name()"/>
66  <xsl:text>&gt;</xsl:text>
67
68</xsl:template>
69
70<xsl:template match="text()" mode="tostring">
71  <xsl:value-of select="."/>
72</xsl:template>
73
74<xsl:template match="texttable/text()" mode="tostring"/>
75<xsl:template match="texttable/c[xref]/text()" mode="tostring"/>
76
77<xsl:template match="section">
78  <xsl:text>&#10;</xsl:text>
79  <c><xsl:value-of select="iref[@item='Headers']/@subitem"/></c>
80  <c>http</c>
81  <c>
82    <xsl:choose>
83      <xsl:when test="ancestor::middle">standard</xsl:when>
84      <xsl:otherwise></xsl:otherwise>
85    </xsl:choose>
86  </c>
87  <c><xref target="{@anchor}"/></c>
88</xsl:template>
89
90</xsl:transform>
Note: See TracBrowser for help on using the repository browser.