I've started experimenting with XML, by having my blogging script output the news to 
XML [http://php.techno-weenie.com/supasite/xml/supa.xml].  I've tried transforming it 
with an XSL stylesheet [http://php.techno-weenie.com/supasite/test.xsl] to get this 
output [http://php.techno-weenie.com/supasite/transform.php].  It looks great, but the 
source code looks really bad.  It looks like it's stripping all the carriage returns 
when it starts matching the news templates.  Does anyone know how to get these back?  
I like to keep my HTML looking at least a little readable, even if the only parts I 
directly edit are the XML and XSL files... 

Here's the source of the PHP script I use:

----------------
class xsl {

var $xsl_content;
var $xml_content;
var $result;

function xsl($xml, $xsl) {
  ### open XML and XSL files ###
  $xml_handle = fopen($xml, "r") or die("Can't open XML file");
  $xsl_handle = fopen($xsl, "r") or die("Can't open XSL file");

  ### get the contents ###
  $this->xml_content = fread($xml_handle, filesize($xml));
  $this->xsl_content = fread($xsl_handle, filesize($xsl));

  ### process files ###
  $handle = xslt_create() or die("Can't create XSLT handle.");
  xslt_process($this->xsl_content, $this->xml_content, $this->result); 

  ### add HTML content to the results ###
  $this->result = str_replace("<", "<", $this->result);
  $this->result = str_replace(">", ">", $this->result);
  @xslt_free($handle);
} # end constructor function
} # end class

$xslt = new xsl("xml/supa.xml", "test.xsl");

echo $xslt->result;
-------------

any assistance would be greatly appreciated....

rick
http://techno-weenie.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to