I want to display an XML file in the middle of my PHP page between two HTML <div> tags. And I am having problems.
My XML file begins as:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://www.fda.gov/oc/datacouncil/stylesheets/spl/spl.xsl" type="text/xsl"?>
<document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://www.fda.gov/oc/datacouncil/schemas/spl/spl.xsd">
The PHP I'm using is:
$xsl = new DOMDocument('1.0','UTF-8');
$xsl->load('http://www.fda.gov/oc/datacouncil/stylesheets/spl/spl.xsl');
$proc = new XSLTProcessor();
$proc->importStylesheet($xsl);
$xml = new DOMDocument('1.0','UTF-8');
$xml->loadXML($label_xml);
$transformedXML = $proc->transformToXml($xml);
echo('<div id="xml1">'.$transformedXML).'</div>';
And I am getting the following errors:
Warning: XSLTProcessor::importStylesheet() [function.XSLTProcessor-importStylesheet]: compilation error: file http://www.fda.gov/oc/datacouncil/stylesheets/spl/xml-verbatim.xsl line 5 element transform in C:\Inetpub\RFX-DEV\LabelData\test_detail.php on line 207
Warning: XSLTProcessor::importStylesheet() [function.XSLTProcessor-importStylesheet]: xsl:version: only 1.0 features are supported in C:\Inetpub\RFX-DEV\LabelData\test_detail.php on line 207
Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Input is not proper UTF-8, indicate encoding ! Bytes: 0xB1 0x29 0x2D 0x31 in Entity, line: 1 in C:\Inetpub\RFX-DEV\LabelData\test_detail.php on line 210
The first two errors seem to be coming from the "ImportStylesheet" command while the last is coming from the "TransformToXml" command.
I am putting this all together by piecing together what examples I can find out there. Any idea what I'm doing wrong and/or the right way to do this? I would certainly appreciate any help one can offer.