I know that there are really a mass of XML XSLT php merging threads at SO. But php specific i could not found what might my problem:
$xml = new DOMDocument;
$xml->load("f.xml");
$xsl = new DOMDocument; $xsl->load('test.xsl');
// init and configure processor $proc = new XSLTProcessor; $proc->importStyleSheet($xsl); // import xsl document $xml2=$proc->transformToXML($xml); echo $xml2;
and one xml file as example:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="owner" select="'Robert Kühn'"/>
<xsl:output method="xml" version="1.0" omit-xml-declaration="yes" indent="no"/>
<xsl:strip-space elements="*"/>
</xsl:stylesheet>
My xslt file looks a bit empty.. However i tried ´output method="xml"´. but it doesnot help.. the xml file is huge and i guess not so important<?xml version="1.0" encoding="UTF-8"?>
<xPac>
<xyz id="15603"><varrDaten id="15604" zeit="1271099572" rechte="1">Daten<vbuch><vsyautor>Alertz, Ulrich</vsyautor><vsytitel>Vom Schiffbauhandwerk zur</vsytitel><vsybarcode>20560194</vsybarcode><vsystatus>S</vsystatus></vbuch><vbuch><vsyautor>Ridolfi, Carlo�[Hrsg.]�</vsyautor><vsytitel>Vite dei Tintoretto da le</vsytitel><vsybarcode>20014784</vsybarcode><vsystatus>S</vsystatus></vbuch><vbuch><vsyautor>Ridolfi, Carlo�[Hrsg.]�</vsyautor><vsytitel> life of Tintoretto and o</vsytitel><vsybarcode>20074791</vsybarcode><vsystatus>S</vsystatus></vbuch></varrDaten></xyz></xPac>
Question: PHP returns always the data as text or html but not in XML.. what i am doing wrong? I only want to edit the XML with xslt and save back to XML (file).
THanks for your help!