I want to insert the following line into my xml file:
<?xml-stylesheet type="text/xsl" href="http://example.com/livesearch.xsl"?>
immediately after:
<?xml version="1.0" encoding="UTF-8" ?>
in my xml file.
Currently I use this (awful) method:
$G['xml'] = str_replace('<?xml version="1.0" encoding="UTF-8" ?>', '<?xml version="1.0" encoding="UTF-8" ?><?xml-stylesheet type="text/xsl" href="http://example.com/livesearch.xsl"?>', $G['xml']);
What is the correct way to do this with DomDocument in php?
Thanks