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 | xmlns:my="#my" |
---|
6 | exclude-result-prefixes="rdf x" |
---|
7 | > |
---|
8 | |
---|
9 | <xsl:output indent="yes" omit-xml-declaration="yes"/> |
---|
10 | |
---|
11 | <my:data> |
---|
12 | <my:item> |
---|
13 | <iref item='Cache Directives' subitem='stale-while-revalidate'> |
---|
14 | <xref target="RFC5861" x:fmt="," x:sec="3"/> |
---|
15 | </iref> |
---|
16 | <iref item='Cache Directives' subitem='stale-if-error'> |
---|
17 | <xref target="RFC5861" x:fmt="," x:sec="4"/> |
---|
18 | </iref> |
---|
19 | </my:item> |
---|
20 | </my:data> |
---|
21 | |
---|
22 | <xsl:template match="/"> |
---|
23 | <xsl:variable name="table"> |
---|
24 | <texttable align="left" suppress-title="true" anchor="iana.cache.directive.registration.table"> |
---|
25 | <ttcol>Cache Directive</ttcol> |
---|
26 | <ttcol>Reference</ttcol> |
---|
27 | <xsl:text> </xsl:text> |
---|
28 | <xsl:apply-templates select="//iref[@item='Cache Directives']|document('')//iref[@item='Cache Directives']"> |
---|
29 | <xsl:sort select="@subitem"/> |
---|
30 | </xsl:apply-templates> |
---|
31 | </texttable> |
---|
32 | <xsl:text> </xsl:text> |
---|
33 | </xsl:variable> |
---|
34 | |
---|
35 | <xsl:comment>AUTOGENERATED FROM extract-cache-directives-defs.xslt, do not edit manually</xsl:comment> |
---|
36 | <xsl:text> </xsl:text> |
---|
37 | <xsl:copy-of select="$table"/> |
---|
38 | <xsl:comment>(END)</xsl:comment> |
---|
39 | <xsl:text> </xsl:text> |
---|
40 | |
---|
41 | <!-- check against current version --> |
---|
42 | <xsl:variable name="oldtable" select="//texttable[@anchor='iana.cache.directive.registration.table']" /> |
---|
43 | |
---|
44 | <xsl:variable name="s"> |
---|
45 | <xsl:apply-templates select="$table//texttable" mode="tostring"/> |
---|
46 | </xsl:variable> |
---|
47 | |
---|
48 | <xsl:variable name="s1"> |
---|
49 | <xsl:apply-templates select="$oldtable" mode="tostring"/> |
---|
50 | </xsl:variable> |
---|
51 | |
---|
52 | <xsl:if test="$s != $s1"> |
---|
53 | <xsl:message>WARNING: table contained inside source document needs to be updated</xsl:message> |
---|
54 | <xsl:message><xsl:value-of select="$s"/></xsl:message> |
---|
55 | <xsl:message><xsl:value-of select="$s1"/></xsl:message> |
---|
56 | </xsl:if> |
---|
57 | |
---|
58 | </xsl:template> |
---|
59 | |
---|
60 | <xsl:template match="*" mode="tostring"> |
---|
61 | <xsl:text><</xsl:text> |
---|
62 | <xsl:value-of select="name()"/> |
---|
63 | <xsl:for-each select="@*"> |
---|
64 | <xsl:sort select="name()"/> |
---|
65 | <xsl:text> </xsl:text> |
---|
66 | <xsl:value-of select="name()"/> |
---|
67 | <xsl:text>=</xsl:text> |
---|
68 | <xsl:value-of select="."/> |
---|
69 | </xsl:for-each> |
---|
70 | <xsl:text>></xsl:text> |
---|
71 | |
---|
72 | <xsl:apply-templates select="node()" mode="tostring"/> |
---|
73 | |
---|
74 | <xsl:text></</xsl:text> |
---|
75 | <xsl:value-of select="name()"/> |
---|
76 | <xsl:text>></xsl:text> |
---|
77 | |
---|
78 | </xsl:template> |
---|
79 | |
---|
80 | <xsl:template match="text()" mode="tostring"> |
---|
81 | <xsl:value-of select="."/> |
---|
82 | </xsl:template> |
---|
83 | |
---|
84 | <xsl:template match="texttable/text()" mode="tostring"/> |
---|
85 | <xsl:template match="texttable/c[xref]/text()" mode="tostring"/> |
---|
86 | |
---|
87 | <xsl:template match="iref"> |
---|
88 | <xsl:variable name="dir" select="@subitem"/> |
---|
89 | <xsl:if test="not(preceding::iref[@item='Cache Directives' and @subitem=$dir])"> |
---|
90 | |
---|
91 | <xsl:text> </xsl:text> |
---|
92 | <c><xsl:value-of select="$dir"/></c> |
---|
93 | <c> |
---|
94 | <xsl:choose> |
---|
95 | <!-- from this XSLT? --> |
---|
96 | <xsl:when test="ancestor::my:item"> |
---|
97 | <xsl:for-each select="xref"> |
---|
98 | <xsl:if test="position()!=1"> |
---|
99 | <xsl:text>, </xsl:text> |
---|
100 | </xsl:if> |
---|
101 | <xref> |
---|
102 | <xsl:copy-of select="@*"/> |
---|
103 | </xref> |
---|
104 | </xsl:for-each> |
---|
105 | </xsl:when> |
---|
106 | <xsl:otherwise> |
---|
107 | <xsl:for-each select="//*[iref[@item='Cache Directives' and @subitem=$dir]]"> |
---|
108 | <xsl:if test="position()!=1"> |
---|
109 | <xsl:text>, </xsl:text> |
---|
110 | </xsl:if> |
---|
111 | <xref target="{ancestor-or-self::*[@anchor][1]/@anchor}"/> |
---|
112 | </xsl:for-each> |
---|
113 | </xsl:otherwise> |
---|
114 | </xsl:choose> |
---|
115 | </c> |
---|
116 | |
---|
117 | </xsl:if> |
---|
118 | </xsl:template> |
---|
119 | |
---|
120 | </xsl:transform> |
---|