source: draft-ietf-httpbis/latest/extract-method-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:executable set to *
File size: 1.9 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.method.registration.table">
13      <ttcol>Method</ttcol>
14      <ttcol>Safe</ttcol>
15      <ttcol>Reference</ttcol>
16      <xsl:apply-templates select="//section[iref/@item='Methods']">
17        <xsl:sort select="iref[@item='Methods']/@subitem"/>
18      </xsl:apply-templates>
19    </texttable>
20    <xsl:text>&#10;</xsl:text>
21  </xsl:variable>
22
23  <xsl:comment>AUTOGENERATED FROM extract-method-defs.xslt, do not edit manually</xsl:comment>
24  <xsl:text>&#10;</xsl:text>
25  <xsl:copy-of select="$table"/>
26  <xsl:comment>(END)</xsl:comment>
27  <xsl:text>&#10;</xsl:text>
28 
29  <!-- check against current version -->
30  <xsl:variable name="oldtable" select="//texttable[@anchor='iana.method.registration.table']" />
31
32  <xsl:if test="string($table//ttcol | $table//c) != string($oldtable//ttcol | $oldtable//c)">
33    <xsl:message>WARNING: table contained inside source document needs to be updated!</xsl:message>
34  </xsl:if>
35 
36</xsl:template>
37
38<xsl:template match="section">
39
40  <xsl:variable name="text" select="iref[@item='Methods']/@subitem"/>
41
42  <xsl:variable name="safe" xmlns:p2="urn:ietf:id:draft-ietf-httpbis-p2-semantics#">
43    <xsl:choose>
44      <xsl:when test="rdf:Description/p2:safe='yes'">yes</xsl:when>
45      <xsl:otherwise>no</xsl:otherwise>
46    </xsl:choose>
47  </xsl:variable>
48
49  <xsl:text>&#10;</xsl:text>
50  <c><xsl:value-of select="$text"/></c>
51  <c><xsl:value-of select="$safe"/></c>
52  <c><xref target="{@anchor}"/></c>
53</xsl:template>
54
55</xsl:transform>
Note: See TracBrowser for help on using the repository browser.