In a nutshell: creating a xml document with PHP DOMDocument(). Need to add a line to the document.
Successfully creating an XML document with:
$doc = new DOMDocument();
$doc->formatOutput = true;
$r = $doc->createElement( "products" );
$doc->appendChild( $r );
while ( $row = mysql_fetch_array($res) )
{
$b = $doc->createElement( "product" );
//adding child elements.....
}
echo $doc->saveXML();
$doc->save("write.xml")
However, at the top of the xml document I need to link to an xls.
<?xml-stylesheet type="text/xsl" href="my.xsl"?>
How do I add that line in the PHP, to the dynamically generated xml?
Thanks.
If you check the manual for DOMDocument, there is actually an example to do exactly what you need in the
createProcessingInstructionmethod, @ http://www.php.net/manual/en/domdocument.createprocessinginstruction.php