DomDocument->create_processing_instruction

(No version information available, might be only in CVS)

DomDocument->create_processing_instruction — Creates new PI node

Описание

domprocessinginstruction DomDocument->create_processing_instruction ( string $content )

This function returns a new instance of class DomCData. The content of the pi is the value of the passed parameter. Этот узел не будет отображаться в документе до тех пор, пока он не будет вставлен, к примеру функцией domnode_append_child().

The return value is FALSE if an error occurred.

See also domnode_append_child(), domdocument_create_element(), domdocument_create_text(), domdocument_create_cdata_section(), domdocument_create_attribute(), domdocument_create_entity_reference(), and domnode_insert_before().

[an error occurred while processing the directive]

Коментарии

Please note that you have to use this function the following way to add a stylsheetr for client side processing.

$pi = $myDoc->create_processing_instruction('','xsl-stylesheet type="text/xsl" href="path_to_my_stylesheet"');

$myDoc->append_child($pi);

And note you have to add this to the document before the rootnode.
2003-10-20 19:29:02
http://php5.kiev.ua/manual/ru/function.domdocument-create-processing-instruction.html
That prior user example creates an invalid processing insruction under 4.3.4.  The first parameter is the processing instruction, and the second can be used for the attributes of the PI.   Here's a code snippet I used to insert a stylesheet:

<?php

$pi 
$doc->create_processing_instruction(
 
"xsl-stylesheet"
 
"type=\"text/xsl\" href=\"$stylesheet\"");
$doc->append_child($pi);

?>
2003-12-01 22:34:33
http://php5.kiev.ua/manual/ru/function.domdocument-create-processing-instruction.html
Автор:
There's an error in both the above examples: it's "xml-stylesheet," not "xsl-stylesheet.Corrected examples:

    $pi = $dom->create_processing_instruction
    (
      "xml-stylesheet",
      "type=\"text/xsl\" href=\"$stylesheet\""
    );
    $dom->append_child($pi);
2004-05-26 05:20:03
http://php5.kiev.ua/manual/ru/function.domdocument-create-processing-instruction.html
note that
string DomDocument->
   create_processing_instruction ( string contenido)
takes two arguments:
- first: the processing instruction,
- second: the arguments and values of
      the processing instruction
:::so must be:
string DomDocument->
    create_processing_instruction ( string prInst,
           string contenido)
2004-08-03 17:31:57
http://php5.kiev.ua/manual/ru/function.domdocument-create-processing-instruction.html

    Поддержать сайт на родительском проекте КГБ