DanC / urlp

No description has been added.

Clone this repository (size: 151.6 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/DanC/urlp/
commit 57: 3dbc6befb6f8
parent 56: cd0a03218375
branch: default
conversion to IETF norms starting to work
Dan Connolly
10 months ago

Changed (Δ3.8 KB):

raw changeset »

wah5/Makefile (12 lines added, 0 lines removed)

wah5/ietf.xsl (172 lines added, 0 lines removed)

Up to file-list wah5/Makefile:

1
XSLTPROC=xsltproc
2
CURL=curl
3
4
5
draft-ietf.html: draft-ietf.xml rfc2629.xslt
6
	$(XSLTPROC) --novalid --output $@ rfc2629.xslt $<
7
draft-ietf.xml: draft.html ietf.xsl
8
	$(XSLTPROC) --novalid --output $@ ietf.xsl $<
9
10
#see http://greenbytes.de/tech/webdav/
11
rfc2629.xslt:
12
	$(CURL) -O http://greenbytes.de/tech/webdav/rfc2629.xslt

Up to file-list wah5/ietf.xsl:

1
<xsl:transform
2
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
    xmlns:h="http://www.w3.org/1999/xhtml"
4
    version="1.0"
5
    >
6
7
<xsl:output
8
    method="xml"
9
    indent="yes"
10
    doctype-system='rfcXXXX.dtd'
11
    />
12
13
<xsl:template match="h:html">
14
  <xsl:apply-templates />
15
</xsl:template>
16
17
<xsl:template match="h:head">
18
  <!-- munch munch -->
19
</xsl:template>
20
21
<xsl:template match="h:body">
22
  <rfc>
23
    <xsl:apply-templates />
24
  </rfc>
25
</xsl:template>
26
27
28
<xsl:template match="h:div[@class='head']">
29
  <front>
30
    <xsl:apply-templates />
31
    <!-- hmm... abstract@@ -->
32
  </front>
33
</xsl:template>
34
35
<xsl:template match="h:h1">
36
  <title>
37
    <xsl:apply-templates />
38
  </title>
39
</xsl:template>
40
41
<xsl:template match="h:dt[ancestor::h:div/@class='head']" >
42
  <!-- drop Editors: label-->
43
</xsl:template>
44
45
<xsl:template match="h:dd[ancestor::h:div/@class='head']" >
46
  <author>
47
    <xsl:text>@@fix/prune author</xsl:text>
48
    <xsl:apply-templates />
49
  </author>
50
</xsl:template>
51
52
53
<xsl:template match="h:h2[ancestor::h:div/@class='head']" >
54
  <date>
55
    <xsl:text>@@fix/prune date</xsl:text>
56
    <xsl:apply-templates />
57
  </date>
58
</xsl:template>
59
60
<xsl:template match="h:p[@class='copyright']">
61
  <!-- "Note that text relating to the memo's status, copyright
62
       notice, or table of contents is not included in the document's
63
       markup — this is automatically inserted by an XML application
64
       when it produces either a text or HTML version of the
65
       document. " - 2.2.7.  Status, Copyright Notice, Table of
66
       Contents -->
67
</xsl:template>
68
69
70
<xsl:template match="h:div[h:h2/h:a/@id='status']" >
71
  <!-- elide -->
72
</xsl:template>
73
74
<xsl:template match="h:div[@class='toc']" >
75
  <!-- elide -->
76
</xsl:template>
77
78
<xsl:template match="h:h2" >
79
  <!-- elide -->
80
</xsl:template>
81
82
83
84
85
<xsl:template match="h:div[@class='body']">
86
  <middle>
87
    <xsl:apply-templates />
88
  </middle>
89
</xsl:template>
90
91
<xsl:template match="h:span[@class='secno']">
92
  <!-- elide -->
93
</xsl:template>
94
95
<xsl:template match="h:div[@class='div1']">
96
  <xsl:variable name="label" select="h:h2" /> <!-- remove secno -->
97
  <xsl:variable name="anchor" select="h:h2/@id" />
98
99
  <section title="{$label}" anchor="{$anchor}">
100
    <xsl:apply-templates />
101
  </section>
102
</xsl:template>
103
104
105
106
107
<xsl:template match="h:p">
108
  <t>
109
    <xsl:apply-templates />
110
  </t>
111
</xsl:template>
112
113
<xsl:template match="h:p">
114
  <t>
115
    <xsl:apply-templates />
116
  </t>
117
</xsl:template>
118
119
<xsl:template match="h:ol">
120
  <list style="numbers">
121
    <xsl:apply-templates />
122
  </list>
123
</xsl:template>
124
125
<xsl:template match="h:ul">
126
  <list style="symbols">
127
    <xsl:apply-templates />
128
  </list>
129
</xsl:template>
130
131
<xsl:template match="h:li">
132
  <xsl:choose>
133
    <xsl:when test="h:p">
134
      <xsl:apply-templates />
135
    </xsl:when>
136
    <xsl:otherwise>
137
      <t>
138
	<xsl:apply-templates />
139
      </t>
140
    </xsl:otherwise>
141
  </xsl:choose>
142
</xsl:template>
143
144
<xsl:template match="h:var">
145
  <spanx style="emph">
146
	<xsl:apply-templates />
147
  </spanx>
148
</xsl:template>
149
150
<xsl:template match="h:code">
151
  <spanx style="verb">
152
	<xsl:apply-templates />
153
  </spanx>
154
</xsl:template>
155
156
157
158
<!-- hypertext references -->
159
<xsl:template match="h:a[@href]">
160
  <xsl:variable name="target" select="substring(@href, 2)" />
161
162
  <xref target="{$target}" />
163
</xsl:template>
164
165
166
<xsl:template match="*">
167
  <xsl:message>warning: <xsl:value-of select="local-name()" />#<xsl:value-of select="@id" />[<xsl:value-of select="@class" />] in <xsl:value-of select="local-name(..)" />#<xsl:value-of select="../@id" />[<xsl:value-of select="../@class" />] not recognized.
168
  </xsl:message>
169
  <xsl:apply-templates />
170
</xsl:template>
171
172
</xsl:transform>