Content deleted Content added
m change source to syntaxhighlight |
m →Examples: HTTP to HTTPS for SourceForge |
||
(6 intermediate revisions by 5 users not shown) | |||
Line 1:
A '''
Processing instructions are exposed in the [[Document Object Model]] as <code>Node.PROCESSING_INSTRUCTION_NODE</code>, and they can be used in [[XPath]] and [[XQuery]] with the 'processing-instruction()' command.
== Syntax ==
An SGML processing instruction is enclosed within <code><?</code> and <code>></code>.<ref>{{cite book |title= SGML and HTML Explained |last= Bryan |first= Martin |publisher= Addison Wesley Longman |year= 1997 |url= https://archive.org/details/sgmlhtmlexplaine0000brya |isbn= 0-201-40394-3 |access-date= 2010-08-18
An XML processing instruction is enclosed within <code><?</code> and <code>?></code>, and contains a ''target'' and optionally some content, which is the node value, that cannot contain the sequence <code>?></code>.<ref>{{cite book | title = The Internet encyclopedia, Volume 3 | url = https://archive.org/details/internetencyclop00bidg_359 | url-access = limited | author = Hossein Bidgoli | page = [https://archive.org/details/internetencyclop00bidg_359/page/n911 877] | publisher = John Wiley and Sons | year = 2004 | isbn = 0-471-22203-8}}</ref>
<syntaxhighlight lang="xml"><?PITarget PIContent?></syntaxhighlight>
The [[XHTML#XML declaration|XML Declaration]] at the beginning of an XML document (shown below) is
<syntaxhighlight lang="xml"><?xml version="1.0" encoding="UTF-8" ?></syntaxhighlight>
== Examples ==
The most common use of a processing instruction is to request the XML document be rendered using a [[Extensible Stylesheet Language|stylesheet]] using the 'xml-stylesheet' target, which was standardized in 1999.<ref>{{Cite web|url=http://www.w3.org/TR/xml-stylesheet/|title=Associating Style Sheets with XML documents 1.0 (Second Edition)}}</ref> It can be used for both [[XSLT]] and [[Cascading Style Sheet|CSS]] stylesheets.
<syntaxhighlight lang="xml"><?xml-stylesheet type="text/xsl" href="style.xsl"?></syntaxhighlight>
<syntaxhighlight lang="xml"><?xml-stylesheet type="text/css" href="style.css"?></syntaxhighlight>
The [[DocBook]] XSLT stylesheets understand a number of processing instructions to override the default behaviour.<ref>
A draft specification for [[Robots exclusion standard]] rules inside XML documents uses processing instructions.<ref>{{cite web |url=http://www.atrus.org/writings/technical/robots_pi/ |title=
== References ==
|