Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using phpreports which is based on XML and get <

Status
Not open for further replies.

scriggs

IS-IT--Management
Jun 1, 2004
286
GB
I am using PHP reports which is based on XML.

When the script runs it produces a HTML page but all the tags are coded with &lt; and &rt; instead of < and >.

This means that the tags are printed in the browser rather than interpreted.

Is this an XML issue, any ideas how I can solve? Is there an XML test I can run to see if my system is OK?
 
Is that what "PHP reports" is supposed to do? Tried on another computer? What's the code of the script?

Jon

"I don't regret this, but I both rue and lament it.
 
Thanks for the reply.

phpreports is a reporting tool developed in PHP (see The script uses XML to create a report in HTML.

It works on lots of computers I am sure, I have tried it on 2 computers I have - home and work. These are both Windows running Apache and PHP5.

When it runs everything works fine except the < and > which are used in tags are shown as &lt; and &rt; which display as < and > on the screen, but do not make the tag work!
 
Do you have to feed an XSL stylesheet into it?

Jon

"I don't regret this, but I both rue and lament it.
 
Jon

Thanks for the reply, but I don't know. I have never used XML, I am just trying to use this opensource solution based on XML.

The files I edit to make it work are PHP, CSS and XML.

There is a directory called XSLT which contains a lot of files with XSL extenstion. I have copied the first one as an example:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL] version="1.0">
<xsl:output method="text" encoding="iso-8859-1" indent="no"/>

<xsl:param name="output_format"/>
<xsl:param name="classname"/>

<xsl:include href="PHPReportRpt.xsl"/>
<xsl:include href="PHPReportForm.xsl"/>
<xsl:include href="PHPReportPage.xsl"/>
<xsl:include href="PHPReportUtil.xsl"/>
<xsl:include href="PHPReportRow.xsl"/>
<xsl:include href="PHPReportFields.xsl"/>
<xsl:include href="PHPReportHeader.xsl"/>
<xsl:include href="PHPReportFooter.xsl"/>
<xsl:include href="PHPReportGroup.xsl"/>
<xsl:include href="PHPReportLink.xsl"/>
<xsl:include href="PHPReportBookmark.xsl"/>
<xsl:include href="PHPReportImg.xsl"/>
<xsl:include href="PHPReportCol.xsl"/>
<xsl:include href="PHPReportXHTML.xsl"/>

<xsl:template match="/">
<xsl:if test="$output_format='file'">
&lt;?php
</xsl:if>
class <xsl:value-of select="$classname"/> {
// An array to store the benchmarks
var $_aBench;

// And a function to return it
function getBenchmarks(){
	return $this->_aBench;
}

// A pre-existing database connection to use instead of connecting
// to the database ourselves
var $_oCon = NULL;
function setDatabaseConnection(&amp;$_oCon){
	$this->_oCon =&amp; $_oCon;
}

function run($sXMLOutputFile=null,$aEnv_=null) {
	$sPath = getPHPReportsFilePath();

	if(is_null($sPath))
		exit("I can't find the paths needed to run. Please refer to the PDF manual to see how to set it.");

	include_once $sPath."/php/PHPReportEvent.php"; 
	include_once $sPath."/php/PHPReportRpt.php"; 
	include_once $sPath."/php/PHPReportXMLElement.php"; 
	include_once $sPath."/php/PHPReportForm.php"; 
	include_once $sPath."/php/PHPReportRow.php";
	include_once $sPath."/php/PHPReportColParm.php"; 
	include_once $sPath."/php/PHPReportLink.php"; 
	include_once $sPath."/php/PHPReportBookmark.php"; 
	include_once $sPath."/php/PHPReportImg.php"; 
	include_once $sPath."/php/PHPReportCol.php"; 
	include_once $sPath."/php/PHPReportField.php"; 
	include_once $sPath."/php/PHPReportGroup.php"; 
	include_once $sPath."/php/PHPReportPage.php"; 

	<xsl:apply-templates/>
	return $oPage->getFileName();
}

}
<xsl:if test="$output_format='file'">
?&gt;
</xsl:if>
</xsl:template>

<!-- template for all text elements -->
<xsl:template match="text()">
	<xsl:value-of select="normalize-space()"/>
</xsl:template>

</xsl:stylesheet>
 
Hmmm, cant really help without looking at php reports in more detail.

As a dirty solution, why dont you run a search and replace script on the output?

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top