Re: How to Insert <?xml-stylesheet .....?> into DOMDocument

From: Date: Sat, 06 Dec 2008 21:24:00 +0000
Subject: Re: How to Insert <?xml-stylesheet .....?> into DOMDocument
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-284243@lists.php.net to get a copy of this message
Shanon Swafford schrieb:
I have the following code: #!/usr/bin/php -q <?PHP error_reporting(E_ALL); ini_set('display_errors', '1');
    $doc = new DOMDocument();
    $doc->formatOutput = true;
    $foo = $doc->createElement("foo");
    $doc->appendChild($foo);
    $bar = $doc->createElement("bar");
    $foo->appendChild($bar);
    $bazz = $doc->createElement("bazz");
    $foo->appendChild($bazz);
    echo $doc->saveXML();
?> Which generates: <?xml version="1.0"?> <foo> <bar/> <bazz/> </foo> Is there a way to make it create the following XML? <?xml version="1.0"?> <?xml-stylesheet href="xsl_table.xsl" type="text/xsl"?> <foo> <bar/> <bazz/> </foo> I can't seem to find any dom functions to do this. Thanks in advance, Shanon Hi Shanon,
please look at the Class itself, if you can modify the Header of the XML data over a method/Constant. Greetings Carlos Medina

« previous php.general (#284243) next »