Processing Instruction: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Add: title, year. Changed bare reference to CS1/2. Removed parameters. | Use this bot. Report bugs. | Suggested by BrownHairedGirl | Linked from User:BrownHairedGirl/Articles_with_bare_links | #UCB_webform_linked 1058/2195
Bender the Bot (talk | contribs)
m Examples: HTTP to HTTPS for SourceForge
 
(4 intermediate revisions by 4 users not shown)
Line 1:
A '''Processingprocessing Instructioninstruction''' ('''PI''') is an [[SGML]] and [[XML]] node type, which may occur anywhere in thea document, intended to carry instructions to the application.<ref>{{Cite book |last=Stayton |first=Bob |title=DocBook XSL: The Complete Guide |chapter-url=http://www.sagehill.net/docbookxsl/ProcessingInstructions.html |publisher=Sagehill Enterprises |date=September 2007 |chapter=Chapter 9. Customization methods §Processing instructions |isbn=978-0974152134}}</ref><ref>[http://www.w3.org/TR/NOTE-sgml-xml-971215 Comparison of SGML and XML; World Wide Web Consortium Note, 15 December 1997]</ref>
 
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 |url-status= dead |url-access= registration }}</ref>
 
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 '''not'''another example of a processing instruction,<ref>{{Cite howeverweb its|title=XML similar1.0 syntax- hasslide often"Processing resultedInstructions in(PIs)" it|url=https://www.w3.org/Consortium/Offices/Presentations/XML1.0/slide30-0.htm being|access-date=2023-02-08 referred|website=www.w3.org}}</ref> tohowever asit amay processingnot instructiontechnically be considered one.<ref name="nutshell">{{cite book | title = XML in a nutshell | author = Elliotte Rusty Harold, W. Scott Means | year = 2004 | isbn = 978-0-596-00764-5 | page = 23 }}</ref>
<syntaxhighlight lang="xml"><?xml version="1.0" encoding="UTF-8" ?></syntaxhighlight>
 
Line 17:
<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>{{Cite web|url=httphttps://docbook.sourceforge.net/release/xsl/current/doc/pi/pi-fo.html|title = Part 2. FO Processing Instruction Reference}}</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=ArchivedRobots copyProcessing Instruction Homepage |accessdate=2010-08-18 |url-status=dead|archiveurl=https://web.archive.org/web/20100921021126/http://www.atrus.org/writings/technical/robots_pi/ |archivedate=2010-09-21 }}</ref>
 
== References ==