index.html
22.8 KB
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en"><head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>XLink Markup Name Control</title><style type="text/css">
code { font-family: monospace; }
div.constraint,
div.issue,
div.note,
div.notice { margin-left: 2em; }
dt.label { display: run-in; }
li p { margin-top: 0.3em;
margin-bottom: 0.3em; }
</style><link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-NOTE"></head><body>
<div class="head"><p><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"></a></p><h1>XLink Markup Name Control</h1><h2>W3C Note 20 December 2000</h2><dl><dt>This version:</dt><dd><a href="http://www.w3.org/TR/2000/NOTE-xlink-naming-20001220">http://www.w3.org/TR/2000/NOTE-xlink-naming-20001220</a><br>(Available as: <a href="http://www.w3.org/TR/2000/NOTE-xlink-naming-20001220/Overview.html">HTML</a>, <a href="http://www.w3.org/TR/2000/NOTE-xlink-naming-20001220/Overview.xml">XML</a>).</dd><dt>Latest version:</dt><dd><a href="http://www.w3.org/TR/xlink-naming">http://www.w3.org/TR/xlink-naming</a></dd><dt>Previous versions:</dt><dd> <a href="http://www.w3.org/TR/2000/NOTE-xlink-naming-20001024/">http://www.w3.org/TR/2000/NOTE-xlink-naming-20001024/</a>
</dd><dt>Editors:</dt>
<dd>Eve Maler, Sun Microsystems
<a href="mailto:elm@east.sun.com"><eve.maler@east.sun.com></a></dd>
<dd>Daniel Veillard, W3C <a href="mailto:bent@exemplary.net"><veillard@w3.org></a>
</dd>
<dd>Henry S. Thompson, University of Edinburgh
<a href="mailto:ht@cogsci.ed.ac.uk"><ht@cogsci.ed.ac.uk></a></dd>
</dl>
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Copyright"> Copyright</a> ©2000 <a
href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
href="http://www.lcs.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a
href="http://www.inria.fr/"><abbr lang="fr" title="Institut National de Recherche en Informatique et
Automatique">INRIA</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Legal_Disclaimer">liability</a>, <a
href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#W3C_Trademarks">trademark</a>, <a
href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</a> and <a
href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</a> rules apply.</p>
</div><hr><div><h2><a name="abstract">Abstract</a></h2>
<p>This document proposes a possible XML Schema-based solution to the need
to use XLink in XML-based languages such as XHTML 1.0.</p>
</div><div><h2><a name="status">Status of this Document</a></h2>
<p>This Note is available for W3C-member review. It has been produced by the
three editors, who are co-chairs of the XML Linking Working Group and editor
of part of the XML Schema spec. respectively. This Note has not been approved
by the group or taken up as a work item.</p>
<p>No commitment is made to update this Note. However, if you have comments,
please send them to the editors.</p>
<p>A list of current W3C Recommendations and other technical documents can
be found at <a href="http://www.w3.org/TR">http://www.w3.org/TR</a>.</p>
</div>
<div class="toc"><h2><a name="contents">Table of Contents</a></h2><p class="toc">1 <a href="#N424">Problem Statement</a><br>2 <a href="#datatypes">Schema Datatypes as a Future Solution</a><br>3 <a href="#extend">Extending the Schema to Support Multiple Links</a><br> 3.1 <a href="#encode">Encoding Semantics in the Type Name</a><br> 3.2 <a href="#arcIndex">Using Schema Annotation to Group XLink Attributes</a><br></p><h3>Appendix</h3><p class="toc">A <a href="#N719">Other Potential Solutions </a><br></p></div><hr><div class="body">
<div class="div1">
<h2><a name="N424"></a>1 Problem Statement</h2>
<p>This document proposes a possible XML Schema-based solution to the need
to use XLink in XML-based languages such as XHTML 1.0.</p>
<p>XLink is a vocabulary that allows you to add hyperlinking to any XML document.
In order to use it, you add XLink-namespaced attributes to elements of your
own design. For example, say the following <code>cmd</code> element normally just
indicates the name of a command in text, so it can be highlighted:</p>
<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre><doc xmlns="http://example.com/myvocab">
...
<p>See <cmd>grep</cmd> for more information.</p>
...
</doc></pre></td></tr></table>
<p>If you wanted to turn it into an XLink hyperlink, you would add a series
of attributes to make it be recognized as such and to provide the relevant
linking information:</p>
<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre><doc
xmlns="http://example.com/myvocab"
xmlns:xlink="http://www.w3.org/1999/xlink">
...
<p>See <cmd
xlink:type="simple"
xlink:href="manpages.xml#grep1">grep</cmd> for
more information.</p>
...
</doc></pre></td></tr></table>
<p>A problem arises if you already have some marked-up information that provides
some of the same kinds of linking information that XLink is designed to provide.
For example, if you have an XHTML document that links the word "grep"
with the <code>grep</code> manpage, you already provide a URI reference pointing
to your desired target in XHTML's own <code>href</code> attribute:</p>
<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre><html>
...
<p>See <a href="manpages.xml#grep1">grep</a> for
more information.</p>
...
</html></pre></td></tr></table>
<p>In order to incorporate XLink usage directly into this vocabulary as a
first-class construct, you would have to force the vocabulary to undergo a
backwards-incompatible change from <code>href</code> to <code>xlink:href</code>.
XLink's attributes must have namespace prefixes on them because of the way
XML namespaces work; "global" attributes that can be attached
to any element must be prefixed because they cannot identify themselves in
any other way.</p>
</div>
<div class="div1">
<h2><a name="datatypes"></a>2 Schema Datatypes as a Future Solution</h2>
<p>XML Schema could be useful in handling XML documents that want to use XLink
but already provide link information in a form that is incompatible with XLink.</p>
<p>Currently, XLink requires applications to recognize a particular set of
attribute names in the XLink namespace in order to do their work, but an imagined
future version of XLink (here called "Schema-XLink" to avoid
any confusion) might allow them to take advantage of XML Schema datatypes
instead, or in addition, as a way to recognize Schema-XLink data. The idea
is that any attribute name could be used, as long as the attribute were "marked"
with an appropriate datatype, made available through a post-schema-validation
information set or by other means. This idea was originally suggested by Henry
Thompson of the XML Schema Working Group.</p>
<p>If Schema-XLink were to define such datatypes, it could provide a normative
XML Schema module that merely contains a series of type definitions. (Note,
however, that as of this writing, XML Schema does not have facilities to specify
additional normative constraints of the style that XLink needs; prose would
still be needed to specify the combinations of attribute types that are expected
to appear on particular "XLink element types.") It is likely
that most vocabularies choosing to use these simple datatypes would incorporate
the Schema-XLink schema module into a higher-level schema that defines stricter
rules as necessary.</p>
<p>Following is how the Schema-XLink module might look.</p>
<div class="note"><p class="prefix"><b>Note:</b></p>
<p>This schema example is non-normative. This Note cannot dictate what problems
future XML Linking Working Groups will be chartered to solve, nor what solutions
they will use to solve them.</p>
</div>
<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre><?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 200010//EN"
"http://www.w3.org/2000/10/XMLSchema.dtd" >
<schema xmlns="http://www.w3.org/2000/10/XMLSchema"
xmlns:xl="http://www.w3.org/2000/10/xlink-ns"
targetNamespace="http://www.w3.org/2000/10/xlink-ns">
<simpleType name="type">
<restriction base="NMTOKEN">
<enumeration value="simple"/>
<enumeration value="extended"/>
<enumeration value="locator"/>
<enumeration value="arc"/>
<enumeration value="resource"/>
<enumeration value="title"/>
<enumeration value="none"/>
</restriction>
</simpleType>
<simpleType name="href">
<restriction base="uriReference"/>
</simpleType>
<simpleType name="role">
<restriction base="uriReference"/>
</simpleType>
<simpleType name="arcrole">
<restriction base="xl:role"/>
</simpleType>
<simpleType name="title">
<restriction base="CDATA"/>
</simpleType>
<simpleType name="show">
<restriction base="NMTOKEN">
<enumeration value="new"/>
<enumeration value="replace"/>
<enumeration value="embed"/>
<enumeration value="other"/>
<enumeration value="none"/>
</restriction>
</simpleType>
<simpleType name="actuate">
<restriction base="NMTOKEN">
<enumeration value="onLoad"/>
<enumeration value="onRequest"/>
<enumeration value="other"/>
<enumeration value="none"/>
</restriction>
</simpleType>
<simpleType name="label">
<restriction base="NMTOKEN"/>
</simpleType>
<simpleType name="from">
<restriction base="xl:label"/>
</simpleType>
<simpleType name="to">
<restriction base="xl:label"/>
</simpleType>
</schema></pre></td></tr></table>
<p>If a higher-level vocabulary were to layer itself on top of Schema-XLink,
it could then use the schema module as follows. This example is for a fictional
vocabulary that has <code>a</code> and <code>img</code> elements that are somewhat
similar to XHTML's elements of the same name. It assigns fixed values to the
elements' attributes, so that users of the vocabulary don't need to set them
explicitly; in this way, it relies on XLink processing to get the desired <code>show</code>
and <code>actuate</code> behavior. It also defines a complex type, <code>myLink</code>,
that provides constraints for what might be called the "basics"
of an XLink simple linking element. The <code>myLink</code> type meets the
needs of this schema, but might be too constraining for some other schema
that wishes to be Schema-XLink-conforming.</p>
<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre><?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 200010//EN"
"http://www.w3.org/2000/10/XMLSchema.dtd" >
<schema xmlns="http://www.w3.org/2000/10/XMLSchema"
xmlns:myvocab="http://www.example.com/myvocab"
xmlns:xl="http://www.w3.org/2000/10/xlink-ns"
targetNamespace="http://www.example.com/myvocab">
<import namespace="http://www.w3.org/2000/10/xlink-ns"/>
<element name="doc">
<complexType mixed="true">
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="myvocab:a"/>
<element ref="myvocab:img"/>
</choice>
</complexType>
</element>
<complexType name="myLink">
<simpleContent>
<extension base="CDATA">
<attribute name="xltype" type="xl:type" use="fixed" value="simple"/>
<attribute name="href" type="xl:href"/>
<attribute name="target" type="xl:show"/>
<attribute name="visit" type="xl:actuate"/>
</extension>
</simpleContent>
</complexType>
<element name="a">
<complexType>
<complexContent>
<restriction base="myvocab:myLink">
<attribute name="target" type="xl:show" use="fixed" value="replace"/>
<attribute name="visit" type="xl:actuate" use="fixed" value="onRequest"/>
</restriction>
</complexContent>
</complexType>
</element>
<element name="img">
<complexType>
<complexContent>
<restriction base="myvocab:myLink">
<attribute name="target" type="xl:show" use="fixed" value="embed"/>
<attribute name="visit" type="xl:actuate" use="fixed" value="onLoad"/>
</restriction>
</complexContent>
</complexType>
</element>
</schema></pre></td></tr></table>
<p>Instead of creating <code>target</code> and <code>visit</code> attributes to
hold fixed values for the traversal behavior for each element type, this vocabulary
could have conveyed the desired behavior semantics in ways that would require
a <code>myvocab</code> processor to act itself (possibly through communicating
with an XLink processor, if the desired behavior is simple enough to fit within
XLink's behavior axes). For example:</p>
<ul>
<li><p>The element type names could be sufficient, since there are only
two elements and their desired traversal behaviors are distinct.</p></li>
<li><p>If the vocabulary had several elements, with some sharing the same
set of traversal behaviors, their declarations could share a named complex
type that would convey the desired behavior.</p></li>
<li><p>If the complex type solution is used, instead of merely using the
type name to convey the desired behavior, each type could set up attributes
with fixed values as shown above.</p></li>
<li><p>Or each complex type could set up an attribute of type <code>xl:arcrole</code>
and give it a value that corresponds to an RDF property.</p></li>
</ul>
</div>
<div class="div1">
<h2><a name="extend"></a>3 Extending the Schema to Support Multiple Links</h2>
<p>The examples in the previous section were relatively simple to accommodate
in that the elements involved had only a single <code>href</code>-type attribute.
This may of course not always be the case. We explore here to alternative
approaches to supporting a schema-based approach to signalling link semantics
when multiple linking attributes are involved, as for example is the case
for XHTML's <code>IMG</code> tag, which has <code>longdesc</code> and <code>usemap</code> <code>href</code>-type
attributes in addition to <code>src</code>.</p>
<p>The primary difficulty in extending the solution proposed in the previous
section to the case of multiple links lies not in identifying the <code>href</code>-type
attributes (the <code>xlink:href</code> simple type can be used for all of
them) but in establishing the semantics of these links, that is, in identifying
their <code>show</code>, <code>actuate</code>, <code>arcrole</code>, etc.
We propose two possible solutions to this problem below, one simpler, but
limited, and the other completely general, but more complex.</p>
<div class="div2">
<h3><a name="encode"></a>3.1 Encoding Semantics in the Type Name</h3>
<p>In this approach, we provide for the most common cases by allowing the
choice of simple type for the <code>href</code>-type attributes to not only
identify them as such, but also to signal their <code>show</code> and <code>actuate</code>,
by providing twenty synonyms for <code>xlink:href</code>:</p>
<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre><schema xmlns="http://www.w3.org/2000/10/XMLSchema"
xmlns:xl="http://www.w3.org/2000/10/xlink-ns"
targetNamespace="http://www.w3.org/2000/10/xlink-ns">
<simpleType name="href-new">
<annotation>
<documentation>Corresponds to show='new' actuate='none'</documentation>
</annotation>
<restriction base="xl:href"/>
</simpleType>
<simpleType name="href-new-onLoad">
<annotation>
<documentation>Corresponds to show='new' actuate='onLoad'</documentation>
</annotation>
<restriction base="xl:href"/>
</simpleType>
. . .
</schema>
</pre></td></tr></table>
<p>Were such types to be provided in the XML Schema for XLink, then the <code>myvocab</code>
example schema in section <a href="#datatypes"><b>2 Schema Datatypes as a Future Solution</b></a> could be both simplified
in expression and extended in coverage as follows:</p>
<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre><?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 200010//EN"
"http://www.w3.org/2000/10/XMLSchema.dtd" >
<schema xmlns="http://www.w3.org/2000/10/XMLSchema"
xmlns:myvocab="http://www.example.com/myvocab"
xmlns:xl="http://www.w3.org/2000/10/xlink-ns"
targetNamespace="http://www.example.com/myvocab">
<import namespace="http://www.w3.org/2000/10/xlink-ns"/>
<element name="doc">
<complexType mixed="true">
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="myvocab:a"/>
<element ref="myvocab:img"/>
</choice>
</complexType>
</element>
<element name="a">
<complexType>
<attribute name="xltype" type="xl:type" use="fixed" value="simple"/>
<attribute name="href" type="xl:href-replace-onRequest"/>
</complexType>
</element>
<element name="img">
<complexType>
<attribute name="xltype" type="xl:type" use="fixed" value="extended"/>
<attribute name="src" type="xl:href-embed-onLoad"/>
<attribute name="longdesc" type="xl:href-new-onRequest"/>
</complexType>
</element>
</schema>
</pre></td></tr></table>
<p>This solution is attractive in its simplicity, but it does require conformant
processors to decode the twenty typenames and act as if the implied <code>show</code>
and <code>actuate</code> attributes were present. It also cannot be extended
to the other XLink attributes such as <code>arcrole</code> or <code>title</code>,
as these do not have a closed set of possible values.</p>
</div>
<div class="div2">
<h3><a name="arcIndex"></a>3.2 Using Schema Annotation to Group XLink Attributes</h3>
<p>Using the provision in XML Schema for annotating declarations with attributes
from user-specified namespaces, we can provide a general solution to the problem,
at the cost of requiring additional schema-sophistication on the part of processors.
We add a single attribute declaration to the XLink schema itself, as follows:</p>
<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre><attribute name="arcIndex" type="positiveInteger"/></pre></td></tr></table>
<p>Then in application schemas with multiple arcs encoded on a single tag,
we annotate the <em>declarations</em> of the XLink-related attributes
with an <code>arcIndex</code>, as follows:</p>
<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre><?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 200010//EN"
"http://www.w3.org/2000/10/XMLSchema.dtd" >
<schema xmlns="http://www.w3.org/2000/10/XMLSchema"
xmlns:myvocab="http://www.example.com/myvocab"
xmlns:xl="http://www.w3.org/2000/10/xlink-ns"
targetNamespace="http://www.example.com/myvocab">
<import namespace="http://www.w3.org/2000/10/xlink-ns"/>
<element name="doc">
<complexType mixed="true">
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="myvocab:a"/>
<element ref="myvocab:img"/>
</choice>
</complexType>
</element>
<element name="a">
<complexType>
<attribute name="xltype" type="xl:type" use="fixed" value="simple"/>
<attribute name="s1" type="xl:show" use="fixed" value="replace"/>
<attribute name="a1" type="xl:actuate" use="fixed" value="onRequest"/>
<attribute name="href" type="xl:href"/>
</complexType>
</element>
<element name="img">
<complexType>
<attribute name="xltype" type="xl:type" use="fixed" value="extended"/>
<attribute name="src" type="xl:href"
xl:arcIndex="1"/>
<attribute name="s1" type="xl:show" use="fixed" value="embed"
xl:arcIndex="1"/>
<attribute name="a1" type="xl:actuate" use="fixed" value="onLoad"
xl:arcIndex="1"/>
<attribute name="t1" type="xl:title" use="fixed" value="The picture itself"
xl:arcIndex="1"/>
<attribute name="longdesc" type="xl:href"
xl:arcIndex="2"/>
<attribute name="s2" type="xl:show" use="fixed" value="new"
xl:arcIndex="2"/>
<attribute name="a2" type="xl:actuate" use="fixed" value="onRequest"
xl:arcIndex="2"/>
<attribute name="t2" type="xl:title" use="fixed" value="A long caption"
xl:arcIndex="2"/>
</complexType>
</element>
</schema>
</pre></td></tr></table>
<p>The result of these declarations is that in the post schema-validation
infoset not only will all the <code>fixed</code> semantic indicator attribute
values be available, but each will be keyed to the appropriate <code>href</code>
by the <code>arcIndex</code> annotation, which is present on each relevant
attribute information item.</p>
</div>
</div>
</div><div class="back">
<div class="div1">
<h2><a name="N719"></a>A Other Potential Solutions </h2>
<p>Besides a potential schema solution, there are other potential solutions
that do not require a backwards-incompatible change to the vocabulary in question;
however, they are outside the scope of this document. Nevertheless, to convey
a sense of the alternatives, here are some possibilities phrased in terms
of XHTML:</p>
<ul>
<li><p>Put <code>xlink:href</code> alongside <code>href</code> with the same
value, so that each could be used by its respective processor. This would
be better as a transition strategy than as a long-term solution.</p></li>
<li><p>Build a transformation into XLink-compliant form into the expected
processing of XHTML.</p></li>
<li><p>Harvest third-party XLink links from the XHTML and use an XLink processor
to operate on them as an expected part of XHTML processing.</p></li>
</ul>
</div>
</div></body></html>