File: rfc2629-noinc.xsl

package info (click to toggle)
memcached 1.6.9%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,820 kB
  • sloc: ansic: 21,174; perl: 7,113; sh: 4,340; python: 402; makefile: 202; xml: 59
file content (104 lines) | stat: -rw-r--r-- 3,082 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

  <xsl:output method="xml"/>

  <xsl:template name='noinc'>
    <xsl:apply-templates mode='noinc'/>
  </xsl:template>

  <xsl:template match="*" mode='noinc'>
    <xsl:copy>
      <xsl:apply-templates select='@*' mode='noinc'/>
      <xsl:apply-templates mode='noinc'/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match='@*' mode='noinc'>
    <xsl:attribute name='{name()}'>
      <xsl:value-of select='.'/>
    </xsl:attribute>
  </xsl:template>

  <xsl:template match='processing-instruction("rfc")' mode='noinc'>
    <xsl:choose>
      <xsl:when test='substring-before(.,"=") = "include"'>
        <xsl:call-template name='include-pi'>
          <xsl:with-param name='include-href'>
            <xsl:value-of select="translate( substring-after( ., '=' ), '&quot; ', '' )"/><xsl:text>.xml</xsl:text>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy-of select='.'/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name='include-pi'>
    <xsl:param name='include-href'/>
    <xsl:apply-templates select="document( $include-href )" mode='noinc'/>
  </xsl:template>

  <xsl:template match='dwdrfc-ref' mode='noinc'>
	<xsl:param name='include-href'>
          <xsl:choose>
            <xsl:when test='starts-with( @src, "http://" )'>
              <xsl:value-of select='@src'/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select='@src'/>
            </xsl:otherwise>
          </xsl:choose>
	</xsl:param>
        <reference anchor="{@anchor}">
          <xsl:apply-templates select="document( $include-href )" mode="refrename"/>
	</reference>
  </xsl:template>

	<xsl:template match='*' mode='refrename'>
	<xsl:apply-templates mode='refrename'/>
	</xsl:template>

	<xsl:template match='reference' mode='refrename'>
	<xsl:apply-templates mode='noinc'/>
	</xsl:template>

  <xsl:template match='/'>
    <xsl:call-template name='noinc'/>
  </xsl:template>

  <xsl:template name='output'>
    <xsl:param name='foo'/>
    <xsl:copy-of select='$foo'/>
    <xsl:apply-templates select='$foo'/>
  </xsl:template>

  <xsl:template match='*' mode='output'>
    <element>
      <xsl:value-of select='name()'/>
      <xsl:apply-templates mode='output'/>
    </element>
  </xsl:template>
  <xsl:template match='text()' mode='output'/>

  <!-- Reference checking attributes stripped here. -->
  <xsl:template match='references' mode='noinc'>
    <xsl:element name='references'>
      <xsl:attribute name='title'>
        <xsl:value-of select='@title'/>
      </xsl:attribute>
      <xsl:apply-templates mode='noinc'/>
    </xsl:element>
  </xsl:template>

  <xsl:template match='xref' mode='noinc'>
    <xsl:element name='xref'>
      <xsl:attribute name='target'>
        <xsl:value-of select='@target'/>
      </xsl:attribute>
      <xsl:apply-templates mode='noinc'/>
    </xsl:element>
  </xsl:template>

</xsl:stylesheet>