转到此链接Convert XML file to attribute XML
and copy/past my question xml file (with name "xml_simple.xml")
and copy/past answer xslt then (with name "xslt4convert.xsl")
copy/past this php file
php code :-
<?php
$sourcedoc = new DOMDocument();
$sourcedoc->load('xml_simple.xml');
$stylesheet = new DOMDocument();
$stylesheet->load('xslt4convert.xsl');
// create a new XSLT processor and load the stylesheet
$xsltprocessor = new XSLTProcessor();
$xsltprocessor->importStylesheet($stylesheet);
// save the new xml file
file_put_contents('xml_converted.xml', $xsltprocessor->transformToXML($sourcedoc));
echo ' xml convert';
?>
并运行这个php文件它生成新的xml文件在每个属性值中
打开这个文件到记事本
它在浏览器中显示一个空格如果我在记事本中打开xml文件,如何删除它是在记事本
中显示
谢谢...