root/branches/binary/server/doc/xml2rfc/rfc2629-noinc.xsl @ 776

Revision 776, 3.1 kB (checked in by astone, 20 months ago)

Rearrange the binary protocol docs and xml2rfc tools.

Line 
1<?xml version="1.0" encoding="utf-8"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                version="1.0">
4
5  <xsl:output method="xml"/>
6
7  <xsl:template name='noinc'>
8    <xsl:apply-templates mode='noinc'/>
9  </xsl:template>
10 
11  <xsl:template match="*" mode='noinc'>
12    <xsl:copy>
13      <xsl:apply-templates select='@*' mode='noinc'/>
14      <xsl:apply-templates mode='noinc'/>
15    </xsl:copy>
16  </xsl:template>
17  <xsl:template match='@*' mode='noinc'>
18    <xsl:attribute name='{name()}'>
19      <xsl:value-of select='.'/>
20    </xsl:attribute>
21  </xsl:template>
22 
23  <xsl:template match='processing-instruction("rfc")' mode='noinc'>
24    <xsl:choose>
25      <xsl:when test='substring-before(.,"=") = "include"'>
26        <xsl:call-template name='include-pi'>
27          <xsl:with-param name='include-href'>
28            <xsl:value-of select="translate( substring-after( ., '=' ), '&quot; ', '' )"/><xsl:text>.xml</xsl:text>
29          </xsl:with-param>
30        </xsl:call-template>
31      </xsl:when>
32      <xsl:otherwise>
33        <xsl:copy-of select='.'/>
34      </xsl:otherwise>
35    </xsl:choose>
36  </xsl:template>
37 
38  <xsl:template name='include-pi'>
39    <xsl:param name='include-href'/>
40    <xsl:apply-templates select="document( $include-href )" mode='noinc'/>
41  </xsl:template>
42 
43  <xsl:template match='dwdrfc-ref' mode='noinc'>       
44        <xsl:param name='include-href'>
45          <xsl:choose>
46            <xsl:when test='starts-with( @src, "http://" )'>
47              <xsl:value-of select='@src'/>
48            </xsl:when>
49            <xsl:otherwise>
50              <xsl:text>http://xml.resource.org/public/rfc/</xsl:text>
51              <xsl:value-of select='@src'/>
52              <xsl:text>.xml</xsl:text>
53            </xsl:otherwise>
54          </xsl:choose>
55        </xsl:param>
56        <reference anchor="{@anchor}">
57          <xsl:apply-templates select="document( $include-href )" mode="refrename"/>
58        </reference>
59  </xsl:template>
60       
61        <xsl:template match='*' mode='refrename'>
62        <xsl:apply-templates mode='refrename'/>
63        </xsl:template>
64       
65        <xsl:template match='reference' mode='refrename'>
66        <xsl:apply-templates mode='noinc'/>
67        </xsl:template>
68 
69  <xsl:template match='/'>
70    <xsl:call-template name='noinc'/>
71  </xsl:template>
72 
73  <xsl:template name='output'>
74    <xsl:param name='foo'/>
75    <xsl:copy-of select='$foo'/>
76    <xsl:apply-templates select='$foo'/>
77  </xsl:template>
78 
79  <xsl:template match='*' mode='output'>
80    <element>
81      <xsl:value-of select='name()'/>
82      <xsl:apply-templates mode='output'/>
83    </element>
84  </xsl:template>
85  <xsl:template match='text()' mode='output'/>
86 
87  <!-- Reference checking attributes stripped here. -->
88  <xsl:template match='references' mode='noinc'>
89    <xsl:element name='references'>
90      <xsl:attribute name='title'>
91        <xsl:value-of select='@title'/>
92      </xsl:attribute>
93      <xsl:apply-templates mode='noinc'/>
94    </xsl:element>
95  </xsl:template>
96 
97  <xsl:template match='xref' mode='noinc'>
98    <xsl:element name='xref'>
99      <xsl:attribute name='target'>
100        <xsl:value-of select='@target'/>
101      </xsl:attribute>
102      <xsl:apply-templates mode='noinc'/>
103    </xsl:element>
104  </xsl:template>
105 
106</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.