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> </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> </xsl:text> |
---|
27 | <xsl:copy-of select="$table"/> |
---|
28 | <xsl:comment>(END)</xsl:comment> |
---|
29 | <xsl:text> </xsl:text> |
---|
30 | |
---|
31 | <!-- check against current version --> |
---|
32 | <xsl:variable name="oldtable" select="//texttable[@anchor='iana.status.code.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><</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>></xsl:text> |
---|
61 | |
---|
62 | <xsl:apply-templates select="node()" mode="tostring"/> |
---|
63 | |
---|
64 | <xsl:text></</xsl:text> |
---|
65 | <xsl:value-of select="name()"/> |
---|
66 | <xsl:text>></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:variable name="text" select="iref[@item='Status Codes']/@subitem"/> |
---|
79 | <xsl:variable name="redirects-to-other-part" xmlns:p2="urn:ietf:id:draft-ietf-httpbis-p2-semantics#" select="rdf:Description/p2:redirects-to"/> |
---|
80 | |
---|
81 | <xsl:if test="not($redirects-to-other-part)"> |
---|
82 | <xsl:text> </xsl:text> |
---|
83 | <c><xsl:value-of select="substring-before($text,' ')"/></c> |
---|
84 | <c><xsl:value-of select="substring($text,2+string-length(substring-before($text,' ')))"/></c> |
---|
85 | <c><xref target="{@anchor}"/></c> |
---|
86 | </xsl:if> |
---|
87 | </xsl:template> |
---|
88 | |
---|
89 | </xsl:transform> |
---|