Working with Processing Instructions

Started by thiruvasagamani, Feb 26, 2009, 02:51 PM

Previous topic - Next topic

thiruvasagamani

Working with Processing Instructions

Processing instructions provide a loosely-structured mechanism for conveying application-specific information within a document. Processing instructions can appear within document, element, document fragment, entity reference, or entity nodes. They have only two components—a name (also called the target) and a value. The value may contain content that looks like attribute values (often called pseudo-attributes), but this content is stored as simple text.

Processing instructions can appear in the document content—within the root element or an element that is the descendant of the root element—or they can appear before or after the root element. The <?xml-stylesheet?> processing instruction, used to connect XML documents to cascading style sheets or XSL Transformations (XSLT) style sheets, usually appears in the prolog.
Examples

The following are script examples.
JScript

The following JScript example identifies which style sheet to use in a processing instruction in the prolog.
J#


var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
var stylePI=xmlDoc.createProcessingInstruction("xml-stylesheet",
  'type="text/xsl" href="show_book.xsl"');
xmlDoc.appendChild(stylePI);



Source : MSDN
Thiruvasakamani Karnan