alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  
<td>StyleSheetPI <td>   ::=    <td>'<?xml-stylesheet' (SPseudoAtt)* S? '?>' <td> </td> </tr> <tr valign="baseline"> <td> <a name="NT-PseudoAtt">[2]    <td>PseudoAtt <td>   ::=    <td> <a href="http://www.w3.org/TR/REC-xml#NT-Name">NameS? '=' S? PseudoAttValue </td> <td> </td> </tr> <tr valign="baseline"> <td> <a name="NT-PseudoAttValue">[3]    <td>PseudoAttValue <td>   ::=    <td>('"' ([^"<&] | CharRef | PredefEntityRef)* '"' <td> </td> </tr> <tr valign="baseline"> <td> </td> <td> </td> <td> </td> <td>| "'" ([^'<&] | CharRef | PredefEntityRef)* "'") <td> </td> </tr> <tr valign="baseline"> <td> </td> <td> </td> <td> </td> <td>- (Char* '?>' Char*) <td> </td> </tr> <tr valign="baseline"> <td> <a name="NT-PredefEntityRef">[4]    <td>PredefEntityRef <td>   ::=    <td>'&amp;' | '&lt;' | '&gt;' | '&quot;' | '&apos;' <td> </td> </tr> </tbody> </table> <p>In PseudoAttValue, a CharRef or a PredefEntityRef is interpreted in the same manner as in a normal XML attribute value. The actual value of the pseudo-attribute is the value after each reference is replaced by the character it references. This replacement is not performed automatically by an XML processor.</p> <p>The 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>

Other Java examples (source code examples)

Here is a short list of links related to this Java xml-stylesheet source code file:

Java example source code file (xml-stylesheet)

This example Java source code file (xml-stylesheet) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

cdata, html, nt\-predefentityref, recommendation, rel, rfc2068, rfc2396, see, the, this, uri, w3c, xml

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/">W3C
<h1>Associating Style Sheets with XML documents
Version 1.0 <h2>W3C Recommendation 29 June 1999 <dl> <dt>This version: <dd> <a href="http://www.w3.org/1999/06/REC-xml-stylesheet-19990629">http://www.w3.org/1999/06/REC-xml-stylesheet-19990629 <br> </dd> <dt>Latest version: <dd> <a href="http://www.w3.org/TR/xml-stylesheet">http://www.w3.org/TR/xml-stylesheet <br> </dd> <dt>Previous version: <dd> <a href="http://www.w3.org/TR/1999/xml-stylesheet-19990428">http://www.w3.org/TR/1999/xml-stylesheet-19990428 <br> </dd> <dt>Editor: <dd> James Clark <a href="mailto:jjc@jclark.com"><jjc@jclark.com> <br> </dd> </dl> <p class="copyright"> <a href="http://www.w3.org/Consortium/Legal/ipr-notice.html#Copyright"> Copyright</a>  ©  1999 W3C (<a href="http://www.lcs.mit.edu">MIT, <a href="http://www.inria.fr/">INRIA, <a href="http://www.keio.ac.jp/">Keio ), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice.html#Legal Disclaimer">liability,trademark, <a href="http://www.w3.org/Consortium/Legal/copyright-documents.html">document use and <a href="http://www.w3.org/Consortium/Legal/copyright-software.html">software licensing rules apply. </p> <hr title="Separator for header"> </div> <h2> <a name="abstract">Abstract </h2> <p>This document allows a style sheet to be associated with an XML document by including one or more processing instructions with a target of <code>xml-stylesheet in the document's prolog.

<h2> <a name="status">Status of this document </h2> <p>This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C <a href="http://www.w3.org/Consortium/Process/#RecsW3C">Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from other documents. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.</p> <p>The list of known errors in this specifications is available at <a href="http://www.w3.org/1999/06/REC-xml-stylesheet-19990629/errata">http://www.w3.org/TR/1999/xml-stylesheet-19990629/errata.

<p>Comments on this specification may be sent to <www-xml-stylesheet-comments@w3.org>. The archive of public comments is available at <a href="http://www.w3.org/Archives/Public/www-xml-stylesheet-comments">http://w3.org/Archives/Public/www-xml-stylesheet-comments.

<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.

<p>The Working Group expects additional mechanisms for linking style sheets to XML document to be defined in a future specification.</p> <p>The use of XML processing instructions in this specification should not be taken as a precedent. The W3C does not anticipate recommending the use of processing instructions in any future specification. The <a href="#rationale">Rationale explains why they were used in this specification.</p> <p>This document was produced as part of the W3C XML Activity.

<h2> <a name="contents">Table of contents </h2>1 The xml-stylesheet processing instruction <br> <h3>AppendicesA References <br>B Rationale <br> <hr> <h2> <a name="The xml-stylesheet processing instruction">1 The xml-stylesheet processing instruction <p>Style Sheets can be associated with an XML[XML10] document by using a processing instruction whose target is <code>xml-stylesheet. This processing instruction follows the behaviour of the HTML 4.0 <code><LINK REL="stylesheet"></code>[HTML40].

<p>The xml-stylesheet processing instruction is parsed in the same way as a start-tag, with the exception that entities other than predefined entities must not be referenced.</p> <p>The following grammar is given using the same notation as the grammar in the XML Recommendation<a href="#XML">[XML10]. Symbols in the grammar that are not defined here are defined in the XML Recommendation.</p> <h5>xml-stylesheet processing instruction <table class="scrap"> <tbody> <tr valign="baseline"> <td> <a name="NT-StyleSheetPI">[1]   
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.