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)
DomDocument::create_processing_instruction
(PHP 4 >= 4.1.0)
DomDocument::create_processing_instruction — Crée un nouveau noeud de traitement d'instructions (PI)
Description
Cette fonction retourne une nouvelle instance de la classe DomCData.
Le contenu de l'unité de traitement sera content.
Le noeud ne sera pas affiché dans le document, à moins
qu'il ne soit inséré avec domnode_append_child().
Retourne FALSE si une erreur survient.
Voir aussi domnode_append_child(), domdocument_create_element(), domdocument_create_text(), domdocument_create_cdata_section(), domdocument_create_attribute(), domdocument_create_entity_reference() et domnode_insert_before().
fru at not dot spam dot com
03-Aug-2004 08:31
AlanCanon
25-May-2004 08:20
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);
apoco at cox dot net
01-Dec-2003 01:34
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);
?>
rj.kamp at hccnet dot nl
20-Oct-2003 10:29
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.
