Processing Instruction: Difference between revisions

Content deleted Content added
No edit summary
Bender the Bot (talk | contribs)
m Examples: HTTP to HTTPS for SourceForge
 
(2 intermediate revisions by 2 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>
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=Robots Processing 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>