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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
---
title: Transforming XML with XSLT
slug: Web/XSLT/Transforming_XML_with_XSLT
tags:
- NeedsMigration
- Transforming_XML_with_XSLT
- XSLT
translation_of: Web/XSLT/Transforming_XML_with_XSLT
---
<p> </p>
<p> </p>
<h3 id="An_Overview" name="An_Overview"><a href="cn/Transforming_XML_with_XSLT/An_Overview">An Overview</a></h3>
<p>The separation of content and presentation is a key design feature of <a href="cn/XML">XML</a>. The structure of an XML document is designed to reflect and clarify important relationships among the individual aspects of the content itself, unhindered by a need to provide any indication about how this data should eventually be presented. This intelligent structuring is particularly important as more and more data transfers are automated and take place between highly heterogeneous machines linked by a network.</p>
<p>Yet eventually much of the content stored in XML documents will need to be presented to human readers. Because a browser provides a familiar and highly flexible interface, it is an ideal mechanism for delivering such presentation versions of XML content. Built from the ground up utilizing a wide variety of XML technologies, Mozilla incorporates within itself all of the mechanisms needed to process both original XML documents and the specialized stylesheets used to style and lay them out for HTML display, reducing server load with client-side processing.</p>
<p>At present, Gecko (the layout engine behind Mozilla and Firefox) supports two forms of XML stylesheets. For basic control of appearance -- fonts, colors, position, and so forth -- Gecko uses <a href="cn/CSS">CSS</a>, familiar from <a href="cn/DHTML">DHTML</a>. All of CSS1 and most of CSS2 are supported. Support for the emerging CSS3 standard is under development. For further information about CSS, see <a class="external" href="http://www.meyerweb.com/eric/css/">Eric Meyer's CSS pages</a>.</p>
<p>Our focus here is on the second type of stylesheet that Gecko supports: the XSLT stylesheet. XSLT stands for eXtensible Stylesheet Language/Transform and the name is apt. XSLT allows a stylesheet author to transform a primary XML document in two significant ways: manipulating and sorting the content, including a wholesale reordering of it if so desired, and transforming the content into a different format (and in the case of Mozilla, the focus is on converting it on the fly into HTML which can then be displayed by the browser).</p>
<h3 id="XSLT.2FXPath_reference" name="XSLT.2FXPath_reference">XSLT/XPath reference</h3>
<h4 id="Elements" name="Elements"><a href="cn/XSLT/Elements">Elements</a></h4>
<ul>
<li><a href="cn/XSLT/apply-imports">xsl:apply-imports</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/apply-templates">xsl:apply-templates</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/attribute">xsl:attribute</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/attribute-set">xsl:attribute-set</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/call-template">xsl:call-template</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/choose">xsl:choose</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/comment">xsl:comment</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/copy">xsl:copy</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/copy-of">xsl:copy-of</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/decimal-format">xsl:decimal-format</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/element">xsl:element</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/fallback">xsl:fallback</a>
<i>
(not supported)</i>
</li>
<li><a href="cn/XSLT/for-each">xsl:for-each</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/if">xsl:if</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/import">xsl:import</a>
<i>
(mostly supported)</i>
</li>
<li><a href="cn/XSLT/include">xsl:include</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/key">xsl:key</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/message">xsl:message</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/namespace-alias">xsl:namespace-alias</a>
<i>
(not supported)</i>
</li>
<li><a href="cn/XSLT/number">xsl:number</a>
<i>
(partially supported)</i>
</li>
<li><a href="cn/XSLT/otherwise">xsl:otherwise</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/output">xsl:output</a>
<i>
(partially supported)</i>
</li>
<li><a href="cn/XSLT/param">xsl:param</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/preserve-space">xsl:preserve-space</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/processing-instruction">xsl:processing-instruction</a></li>
<li><a href="cn/XSLT/sort">xsl:sort</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/strip-space">xsl:strip-space</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/stylesheet">xsl:stylesheet</a>
<i>
(partially supported)</i>
</li>
<li><a href="cn/XSLT/template">xsl:template</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/text">xsl:text</a>
<i>
(partially supported)</i>
</li>
<li><a href="cn/XSLT/transform">xsl:transform</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/value-of">xsl:value-of</a>
<i>
(partially supported)</i>
</li>
<li><a href="cn/XSLT/variable">xsl:variable</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/when">xsl:when</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XSLT/with-param">xsl:with-param</a>
<i>
(supported)</i>
</li>
</ul>
<h4 id="Axes" name="Axes"><a href="cn/XPath/Axes">Axes</a></h4>
<ul>
<li><a href="cn/XPath/Axes/ancestor">ancestor</a></li>
<li><a href="cn/XPath/Axes/ancestor-or-self">ancestor-or-self</a></li>
<li><a href="cn/XPath/Axes/attribute">attribute</a></li>
<li><a href="cn/XPath/Axes/child">child</a></li>
<li><a href="cn/XPath/Axes/descendant">descendant</a></li>
<li><a href="cn/XPath/Axes/descendant-or-self">descendant-or-self</a></li>
<li><a href="cn/XPath/Axes/following">following</a></li>
<li><a href="cn/XPath/Axes/following-sibling">following-sibling</a></li>
<li><a href="cn/XPath/Axes/namespace">namespace</a>
<i>
(not supported)</i>
</li>
<li><a href="cn/XPath/Axes/parent">parent</a></li>
<li><a href="cn/XPath/Axes/preceding">preceding</a></li>
<li><a href="cn/XPath/Axes/preceding-sibling">preceding-sibling</a></li>
<li><a href="cn/XPath/Axes/self">self</a></li>
</ul>
<h4 id="Functions" name="Functions"><a href="cn/XPath/Functions">Functions</a></h4>
<ul>
<li><a href="cn/XPath/Functions/boolean">boolean()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/ceiling">ceiling()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/concat">concat()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/contains">contains()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/count">count()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/current">current()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/document">document()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/element-available">element-available()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/false">false()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/floor">floor()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/format-number">format-number()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/function-available">function-available()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/generate-id">generate-id()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/id">id()</a>
<i>
(partially supported)</i>
</li>
<li><a href="cn/XPath/Functions/key">key()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/lang">lang()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/last">last()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/local-name">local-name()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/name">name()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/namespace-uri">namespace-uri()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/normalize-space">normalize-space()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/not">not()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/number">number()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/position">position()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/round">round()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/starts-with">starts-with()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/string">string()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/string-length">string-length()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/substring">substring()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/substring-after">substring-after()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/substring-before">substring-before()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/sum">sum()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/system-property">system-property()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/translate">translate()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/true">true()</a>
<i>
(supported)</i>
</li>
<li><a href="cn/XPath/Functions/unparsed-entity-url">unparsed-entity-url()</a>
<i>
(not supported)</i>
</li>
</ul>
<h3 id="For_Further_Reading" name="For_Further_Reading"><a href="cn/Transforming_XML_with_XSLT/For_Further_Reading">For Further Reading</a></h3>
<ul>
<li><a href="cn/Transforming_XML_with_XSLT/For_Further_Reading#Books">Books</a></li>
<li><a href="cn/Transforming_XML_with_XSLT/For_Further_Reading#Online">Online</a>
<ul>
<li><a href="cn/Transforming_XML_with_XSLT/For_Further_Reading#The_World_Wide_Web_Consortium">The World Wide Web Consortium</a></li>
<li><a href="cn/Transforming_XML_with_XSLT/For_Further_Reading#Portals">Portals</a></li>
<li><a href="cn/Transforming_XML_with_XSLT/For_Further_Reading#Articles">Articles</a></li>
<li><a href="cn/Transforming_XML_with_XSLT/For_Further_Reading#Tutorials.2FExamples">Tutorials/Examples</a></li>
<li><a href="cn/Transforming_XML_with_XSLT/For_Further_Reading#Mailing_Lists.2FNewsgroups">Mailing Lists/Newsgroups</a></li>
</ul>
</li>
</ul>
<h3 id="Resources" name="Resources"><a href="cn/Transforming_XML_with_XSLT/Resources">Resources</a></h3>
<h3 id="Index" name="Index"><a href="cn/Transforming_XML_with_XSLT/Index">Index</a></h3>
<div class="originaldocinfo">
<h3 id="Original_Document_Information" name="Original_Document_Information">Original Document Information</h3>
<ul>
<li>Copyright Information: Copyright © 2001-2003 Netscape. All rights reserved.</li>
<li>Note: This reprinted article was originally part of the DevEdge site.</li>
</ul>
</div>
<p>{{ languages( { "es": "es/Transformando_XML_con_XSLT", "fr": "fr/Transformations_XML_avec_XSLT", "pl": "pl/Transformacje_XML_z_XSLT", "ko": "ko/Transforming_XML_with_XSLT" } ) }}</p>
|