How to Insert <?xml-stylesheet .....?> into DOMDocument
| From: | Shanon Swafford | Date: | Sat, 06 Dec 2008 07:03:21 +0000 |
| Subject: | How to Insert <?xml-stylesheet .....?> into DOMDocument | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-284231@lists.php.net to get a copy of this message | ||
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