[815] | 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"
|
---|
[825] | 5 | xmlns:my="#my"
|
---|
[815] | 6 | exclude-result-prefixes="rdf x"
|
---|
| 7 | >
|
---|
| 8 |
|
---|
| 9 | <xsl:output indent="yes" omit-xml-declaration="yes"/>
|
---|
| 10 |
|
---|
[825] | 11 | <my:data>
|
---|
| 12 | <my:item>
|
---|
[1896] | 13 | <iref item='stale-while-revalidate (cache directive)'>
|
---|
[825] | 14 | <xref target="RFC5861" x:fmt="," x:sec="3"/>
|
---|
| 15 | </iref>
|
---|
[1896] | 16 | <iref item='stale-if-error (cache directive)'>
|
---|
[825] | 17 | <xref target="RFC5861" x:fmt="," x:sec="4"/>
|
---|
| 18 | </iref>
|
---|
| 19 | </my:item>
|
---|
| 20 | </my:data>
|
---|
| 21 |
|
---|
[815] | 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>
|
---|
[1896] | 28 | <xsl:apply-templates select="//iref[contains(@item,' (cache directive)') and @primary='true']|document('')//iref">
|
---|
| 29 | <xsl:sort select="@item"/>
|
---|
[815] | 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">
|
---|
[1896] | 88 | <xsl:variable name="t" select="@item"/>
|
---|
| 89 | <xsl:variable name="dir" select="substring-before($t,' (cache directive)')"/>
|
---|
| 90 | <xsl:if test="not(preceding::iref[@item=$t])">
|
---|
[815] | 91 |
|
---|
| 92 | <xsl:text> </xsl:text>
|
---|
| 93 | <c><xsl:value-of select="$dir"/></c>
|
---|
| 94 | <c>
|
---|
[825] | 95 | <xsl:choose>
|
---|
| 96 | <!-- from this XSLT? -->
|
---|
| 97 | <xsl:when test="ancestor::my:item">
|
---|
| 98 | <xsl:for-each select="xref">
|
---|
| 99 | <xsl:if test="position()!=1">
|
---|
| 100 | <xsl:text>, </xsl:text>
|
---|
| 101 | </xsl:if>
|
---|
| 102 | <xref>
|
---|
| 103 | <xsl:copy-of select="@*"/>
|
---|
| 104 | </xref>
|
---|
| 105 | </xsl:for-each>
|
---|
| 106 | </xsl:when>
|
---|
| 107 | <xsl:otherwise>
|
---|
[1896] | 108 | <xsl:for-each select="//*[iref[@item=$t]]">
|
---|
[825] | 109 | <xsl:if test="position()!=1">
|
---|
| 110 | <xsl:text>, </xsl:text>
|
---|
| 111 | </xsl:if>
|
---|
| 112 | <xref target="{ancestor-or-self::*[@anchor][1]/@anchor}"/>
|
---|
| 113 | </xsl:for-each>
|
---|
| 114 | </xsl:otherwise>
|
---|
| 115 | </xsl:choose>
|
---|
[815] | 116 | </c>
|
---|
[825] | 117 |
|
---|
[815] | 118 | </xsl:if>
|
---|
| 119 | </xsl:template>
|
---|
| 120 |
|
---|
| 121 | </xsl:transform> |
---|