Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
CanaryMason #1
applying xsl to dynamically created xml
I've been puzzling over this for hours. I hope someone here can help me out.
I'm building a site that takes data from a MYSQL database and then dynamically
builds XML strings with PHP. This is then fed into Flash. So far, so good.
Everything's working.
Next I want to repurpose that XML (built by PHP) with XSL into a non-Flash
version of the site. Here's where I'm running into trouble.
When I apply the "XSL Transformation" behavior to a page and set the XML
source to my PHP page (which to be clear writes an XML string) I get the
following error:
MM_XSLTransform error.
../data/home.php is not a valid XML document.
XML parser error 4: not well-formed (invalid token) in file %s
<?php header('Content-Type: application/xml'); ?>
<?php require_once('../Connections/delutzMYSQL.php'); ?>
<?php
mysql_select_db($database_delutzMYSQL, $delutzMYSQL);
$rs_welcome = mysql_query("SELECT * FROM tbl_welcome ORDER BY wel_date DESC
LIMIT 1");
//
//
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<homePage>";
// WELCOME --
echo "<welcome>";
$welcomeRow = mysql_fetch_array($rs_welcome);
$WelcomeText = str_replace("
", "", $welcomeRow["wel_text"]);
@printf ("<![CDATA[%s]]>", $WelcomeText);
echo "</welcome>";
// --WELCOME
echo "</homePage>";
//
//
mysql_free_result($rs_welcome);
?>
The source of my start page looks like this:
<?php
//XMLXSL Transformation class
require_once('../../../../includes/MM_XSLTransform/MM_XSLTransform.class.php');
?>
<?php
$mm_xsl = new MM_XSLTransform();
$mm_xsl->setXML("../data/home.php");
$mm_xsl->setXSL("index.xsl");
echo $mm_xsl->Transform();
?>
My PHP file looks like this:
<?php header('Content-Type: application/xml'); ?>
<?php require_once('../Connections/delutzMYSQL.php'); ?>
<?php
mysql_select_db($database_delutzMYSQL, $delutzMYSQL);
$rs_welcome = mysql_query("SELECT * FROM tbl_welcome ORDER BY wel_date DESC
LIMIT 1");
//
//
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<homePage>";
// WELCOME --
echo "<welcome>";
$welcomeRow = mysql_fetch_array($rs_welcome);
$WelcomeText = str_replace("
", "", $welcomeRow["wel_text"]);
@printf ("<![CDATA[%s]]>", $WelcomeText);
echo "</welcome>";
// --WELCOME
echo "</homePage>";
//
//
mysql_free_result($rs_welcome);
?>
It works fine when I set the XML source to a "*.XML" file, but fails when I
set it to my ".PHP" file.
I'm hoping that someone here could either point out an error in my code, show
me the right way to accomplish this, or tell me about an alternate technique.
thanks a lot,
-=Mason
CanaryMason Guest
-
Managing ViewState of a dynamically created Custom Composite Server Control -(where the original is also dynamically created)
Ok here's my scenario. I have a Custom Composite Server Control (CCSC) consisting of a TextBox, Button & Panel. (And some other code - which I... -
How save an MSWORD doc that was dynamically created?
:rose; I've tried creating a WORD file dynamically with <CFCONTENT>. But I don't want to display it in the browser. I just want to save it to use... -
Referencing Dynamically created controls
Can anyone tell me how to reference a a control, e.g. a control I have added to the controls collection without specifically naming it. Also can... -
need help with dynamically created user control
i have a dynamically created user control which contains a non-dynamically created ASP.Net button. When the button is clicked, the event is not... -
get formvalues - dynamically created controls
C.H., You could loop through them using their index. Instead of using FindControl and the control's name you could just use the index of the...



Reply With Quote

