source: draft-ietf-httpbis/latest/extract-method-defs.xslt @ 2293

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

Trim index.

  • Property svn:executable set to *
File size: 3.4 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>Idempotent</ttcol>
16      <ttcol>Reference</ttcol>
17      <xsl:apply-templates select="//section[iref[contains(@item,' method') and @primary='true']]">
18        <xsl:sort select="iref[contains(@item,' method') and @primary='true']/@item"/>
19      </xsl:apply-templates>
20    </texttable>
21    <xsl:text>&#10;</xsl:text>
22  </xsl:variable>
23
24  <xsl:comment>AUTOGENERATED FROM extract-method-defs.xslt, do not edit manually</xsl:comment>
25  <xsl:text>&#10;</xsl:text>
26  <xsl:copy-of select="$table"/>
27  <xsl:comment>(END)</xsl:comment>
28  <xsl:text>&#10;</xsl:text>
29 
30  <!-- check against current version -->
31  <xsl:variable name="oldtable" select="//texttable[@anchor='iana.method.registration.table']" />
32
33  <xsl:variable name="s">
34    <xsl:apply-templates select="$table//texttable" mode="tostring"/>
35  </xsl:variable>
36 
37  <xsl:variable name="s1">
38    <xsl:apply-templates select="$oldtable" mode="tostring"/>
39  </xsl:variable>
40
41  <xsl:if test="$s != $s1">
42    <xsl:message>WARNING: table contained inside source document needs to be updated</xsl:message>
43    <xsl:message><xsl:value-of select="$s"/></xsl:message>
44    <xsl:message><xsl:value-of select="$s1"/></xsl:message>
45  </xsl:if>
46 
47</xsl:template>
48
49<xsl:template match="*" mode="tostring">
50  <xsl:text>&lt;</xsl:text>
51  <xsl:value-of select="name()"/>
52  <xsl:for-each select="@*">
53    <xsl:sort select="name()"/>
54    <xsl:text> </xsl:text>
55    <xsl:value-of select="name()"/>
56    <xsl:text>=</xsl:text>
57    <xsl:value-of select="."/>
58  </xsl:for-each>
59  <xsl:text>&gt;</xsl:text>
60 
61  <xsl:apply-templates select="node()" mode="tostring"/>
62 
63  <xsl:text>&lt;/</xsl:text>
64  <xsl:value-of select="name()"/>
65  <xsl:text>&gt;</xsl:text>
66
67</xsl:template>
68
69<xsl:template match="text()" mode="tostring">
70  <xsl:value-of select="."/>
71</xsl:template>
72
73<xsl:template match="texttable/text()" mode="tostring"/>
74<xsl:template match="texttable/c[xref]/text()" mode="tostring"/>
75
76<xsl:template match="section">
77  <xsl:variable name="t" select="iref[contains(@item,' method')]/@item"/>
78  <xsl:variable name="text" select="substring-before($t,' method')"/>
79
80  <xsl:variable name="safe" xmlns:p2="urn:ietf:id:draft-ietf-httpbis-p2-semantics#">
81    <xsl:choose>
82      <xsl:when test="rdf:Description/p2:safe='yes'">yes</xsl:when>
83      <xsl:otherwise>no</xsl:otherwise>
84    </xsl:choose>
85  </xsl:variable>
86
87  <xsl:variable name="idempotent" xmlns:p2="urn:ietf:id:draft-ietf-httpbis-p2-semantics#">
88    <xsl:choose>
89      <xsl:when test="rdf:Description/p2:idempotent='yes'">yes</xsl:when>
90      <xsl:otherwise>no</xsl:otherwise>
91    </xsl:choose>
92  </xsl:variable>
93
94  <xsl:text>&#10;</xsl:text>
95  <c><xsl:value-of select="$text"/></c>
96  <c><xsl:value-of select="$safe"/></c>
97  <c><xsl:value-of select="$idempotent"/></c>
98  <c><xref target="{@anchor}"/></c>
99</xsl:template>
100
101</xsl:transform>
Note: See TracBrowser for help on using the repository browser.