|
xml-stylesheet
processing instruction is allowed
only in the prolog of an XML document. The syntax of XML constrains
where processing instructions are allowed in the prolog; the
<code>xml-stylesheet processing instruction is allowed anywhere
in the prolog that meets these constraints.</p>
<blockquote>
<b>NOTE: If the xml-stylesheet
processing instruction
occurs in the external DTD subset or in a parameter entity, it is
possible that it may not be processed by a non-validating XML
processor (see <a href="#XML">[XML10]).
<p>The following pseudo attributes are defined
<pre>href CDATA #REQUIRED
type CDATA #REQUIRED
title CDATA #IMPLIED
media CDATA #IMPLIED
charset CDATA #IMPLIED
alternate (yes|no) "no"</pre>
<p>The semantics of the pseudo-attributes are exactly as with
<code><LINK REL="stylesheet"> in HTML 4.0, with the
exception of the <code>alternate pseudo-attribute. If
<code>alternate="yes" is specified, then the processing
instruction has the semantics of <code><LINK REL="alternate
stylesheet"></code> instead of <LINK
REL="stylesheet"></code>.
<blockquote>
<b>NOTE: Since the value of the href
attribute is a URI
reference, it may be a relative URI and it may contain a fragment
identifier. In particular the URI reference may contain only a
fragment identifier. Such a URI reference is a reference to a part of
the document containing the <code>xml-stylesheet
processing
instruction (see <a href="#RFC2396">[RFC2396]). The consequence is that the
<code>xml-stylesheet processing instruction allows style sheets
to be embedded in the same document as the <code>xml-stylesheet
processing instruction.</blockquote>
<p>In some cases, style sheets may be linked with an XML document by
means external to the document. For example, earlier versions of HTTP
<a href="#RFC2068">[RFC2068] (section 19.6.2.4) allowed style sheets to be
associated with XML documents by means of the <code>Link
header. Any links to style sheets that are specified externally to the
document are considered to occur before the links specified by the
<code>xml-stylesheet processing instructions. This is the same
as in HTML 4.0 (see <a href="http://www.w3.org/TR/REC-html40/present/styles.html#h-14.6">section
14.6</a>).
<p>Here are some examples from HTML 4.0 with the corresponding
processing instruction:</p>
<pre><LINK href="mystyle.css" rel="style sheet" type="text/css">
<?xml-stylesheet href="mystyle.css" type="text/css"?>
<LINK href="mystyle.css" title="Compact" rel="stylesheet"
type="text/css">
<?xml-stylesheet href="mystyle.css" title="Compact" type="text/css"?>
<LINK href="mystyle.css" title="Medium" rel="alternate stylesheet"
type="text/css">
<?xml-stylesheet alternate="yes" href="mystyle.css" title="Medium"
type="text/css"?></pre>
<p>Multiple xml-stylesheet
processing instructions are
also allowed with exactly the same semantics as with <code>LINK
REL="stylesheet"</code>. For example,
<pre><LINK rel="alternate stylesheet" title="compact" href="small-base.css"
type="text/css">
<LINK rel="alternate stylesheet" title="compact" href="small-extras.css"
type="text/css">
<LINK rel="alternate stylesheet" title="big print" href="bigprint.css"
type="text/css">
<LINK rel="stylesheet" href="common.css" type="text/css"></pre>
<p>would be equivalent to:
<pre><?xml-stylesheet alternate="yes" title="compact" href="small-base.css"
type="text/css"?>
<?xml-stylesheet alternate="yes" title="compact" href="small-extras.css"
type="text/css"?>
<?xml-stylesheet alternate="yes" title="big print" href="bigprint.css"
type="text/css"?>
<?xml-stylesheet href="common.css" type="text/css"?></pre>
<hr title="Separator from footer">
<h2>
<a name="References">A References
<dl>
<dt>
<a name="HTML">HTML40
</dt>
<dd>World Wide Web
Consortium. <i>HTML 4.0 Specification. W3C Recommendation. See
<a href="http://www.w3.org/TR/REC-html40">http://www.w3.org/TR/REC-html40
</dd>
<dt>
<a name="RFC2068">RFC2068
</dt>
<dd>R. Fielding, J. Gettys, J. Mogul,
H. Frystyk Nielsen, and T. Berners-Lee. <i>Hypertext Transfer
Protocol -- HTTP/1.1.</i>. IETF RFC 2068. See http://www.ietf.org/rfc/rfc2068.txt.
<dt>
<a name="RFC2396">RFC2396
</dt>
<dd>T. Berners-Lee, R. Fielding, and
L. Masinter. <i>Uniform Resource Identifiers (URI): Generic
Syntax</i>. IETF RFC 2396. See http://www.ietf.org/rfc/rfc2396.txt.
<dt>
<a name="XML">XML10
</dt>
<dd>World Wide Web Consortium. Extensible
Markup Language (XML) 1.0.</i> W3C Recommendation. See http://www.w3.org/TR/1998/REC-xml-19980210
</dd>
</dl>
<h2>
<a name="rationale">B Rationale
<p>There was an urgent requirement for a specification for style sheet
linking that could be completed in time for the next release from
major browser vendors. Only by choosing a simple mechanism closely
based on a proven existing mechanism could the specification be
completed in time to meet this requirement.</p>
<p>Use of a processing instruction avoids polluting the main document
structure with application specific processing information.</p>
<p>The mechanism chosen for this version of the specification is not a
constraint on the additional mechanisms planned for future versions.
There is no expectation that these will use processing instructions;
indeed they may not include the linking information in the source
document.</p>
</body>
</html>
Here is a short list of links related to this Java xml-stylesheet source code file:
Java example source code file (xml-stylesheet)
The xml-stylesheet Java example source code<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Associating Style Sheets with XML documents <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-REC"> <style type="text/css">code { font-family: monospace } </head> <body> <div class="head"> <a href="http://www.w3.org/"> |
... this post is sponsored by my books ... | |
![]() #1 New Release! |
![]() FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.