Mam nastepujacy problem: Uzywam prostego pliku xml do zapisania kategorii w mini CMS'ie:
<?xml version="1.0"?> <categories> <category id="0">rozrywka</category> <category id="1">nauka</category> <category id="2">polityka</category> <category id="3">technologie</category> <category id="4">humor</category> <category id="5">erotyka</category> </categories>
Przetwarzam go nastepujacym arkuszem XSLT:
Kod
<?xml version="1.0" encoding="iso-8859-2"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="iso-8859-2" indent="yes"/>
<xsl:template match="/">
<select name="content">
<xsl:for-each select="categories/category">
<option><xsl:value-of select="."/></option>
</xsl:for-each>
</select>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="iso-8859-2" indent="yes"/>
<xsl:template match="/">
<select name="content">
<xsl:for-each select="categories/category">
<option><xsl:value-of select="."/></option>
</xsl:for-each>
</select>
</xsl:template>
</xsl:stylesheet>
Uzywam do tego funkcji DOMXML:
Kod
function processXSLT($xml_file, $xsl_file) {
$xmldoc = domxml_open_file($xml_file);
$xsldoc = domxml_xslt_stylesheet_file($xsl_file);
$result = $xsldoc->process($xmldoc);
return($xsldoc->result_dump_mem($result));
}
$xmldoc = domxml_open_file($xml_file);
$xsldoc = domxml_xslt_stylesheet_file($xsl_file);
$result = $xsldoc->process($xmldoc);
return($xsldoc->result_dump_mem($result));
}
Wywolanie funkcji nic nie zwraca chociaz w przypadku innych arkuszy XSL dziala poprawnie. Problem powinien wiec lezec w arkuszu XSL. Poniewaz dopiero ucze sie XSLT uzywam edytora WYSIWYG Stylus Studio. W nim output tego arkusza jest prawidlowy.
Gdzie robie blad ?
Umieszcze jeszcze konfiguracje modulu DOMXML:
DOM/XML enabled
DOM/XML API Version 20020815
libxml Version 20511
HTML Support enabled
XPath Support enabled
XPointer Support enabled
DOM/XSLT enabled
libxslt Version 1.0.33
libxslt compiled against libxml Version 2.5.11
Dziekuje za wszelka pomoc.
Pozdrawiam.