Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Help > PHP Programming Help

PHP Programming Help Post any question relating to PHP Programming here and hopefully someone can help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2005-07-20, 12:14 PM
Junior Member
 
Join Date: Jul 2005
Posts: 3
hame22
Default

Hi all

I have 3 files

a xsl stylesheet file, a php transformation file and a php file that dynamicaly produces xml from a mysql database.

what i want to do is transform the xml in the php file with the xsl stylesheet through the php processor file.

However i have encounted a number of problems due to the fact that my xml is generated in a php file.

the error i recieve is this
XSLT processing error: XML parser error 4: not well-formed (invalid token)

and my processor file is this:


Code:
Code:
<?

// Xml and XSL files
$xml_file = "test.php";
$xsl_file = "xml2.xsl";

// Allocate a new XSLT processor
$xh = xslt_create();
$fileBase = 'file://' . getcwd () . '/';
xslt_set_base ( $xh, $fileBase );

// Process the document
$result = xslt_process($xh, $xml_file, $xsl_file);
if (!$result) {
  // Something croaked. Show the error
  echo 'XSLT processing error: ' .xslt_error($xh);
}
else {
  // Output the resulting HTML
  echo $result;
}

// Destroy the XSLT processor
xslt_free($xh);

?>
it works fine if i use a standard xml file -- $xml_file = "test.xml";

however i require the xml to be dynamically generated due to an id variable and php is the way of doing this.

Does anyone have any idea how I can do an xsl transformation on a php file that generates xml??

thanks in advance

alex
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:09 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.