Location: PHPKode > projects > Sourdough > sourdough/Sd_Xslt/Sd_Xslt_php5.class.php
<?php
//
// +--------------------------------------------------------------------+
// | Sourdough PHP Application Framework                                |
// +--------------------------------------------------------------------+
// | Copyright (c) 2001-2007 Philip Iezzi, phpee.com                    |
// | Web           http://sourdough.phpee.com/                          |
// | License       GNU Lesser General Public License (LGPL)             |
// +--------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or      |
// | modify it under the terms of the GNU Lesser General Public         |
// | License as published by the Free Software Foundation; either       |
// | version 2.1 of the License, or (at your option) any later version. |
// +--------------------------------------------------------------------+
//

/**
* Sourdough PHP Application Framework
* @package      sourdough
* @subpackage   xslt
*/
/**
* SOURDOUGH XSL transformation class for PHP5's new libxml2 library
*
* @package      sourdough
* @subpackage   xslt
* @author       Philip Iezzi <hide@address.com>
* @copyright    Copyright (c) 2001-2007 PHPEE.COM
* @license      http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
* @version      $Id: Sd_Xslt_php5.class.php 3003 2007-12-08 11:05:17Z piezzi $
*/
class Sd_Xslt_php5 extends Sd_Xslt {
//[start] Constructor
	/**
	* Sd_Xslt_php5 constructor
	*
	* @param    Sourdough  $Sourd  Sourdough global object
	*/
	public function __construct(Sourdough $Sourd)
	{
		$this->Sourdough = $Sourd;
		parent::__construct();
	}
//[end]

//[start] Public Methods
	/**
	* PHP5 XSL transformation
	*
	* @return    void
	*/
	public function transform()
	{
		$dom = new domDocument();
//		$dom->substituteEntities = true;
//		$dom->xmlSubstituteEntitiesDefault(1);
		$dom->load($this->XSL);
		$proc = new XSLTProcessor();
		$xsl = $proc->importStylesheet($dom);
		
		$document = new DomDocument();
		$document->load($this->XML);
		$this->out = $proc->transformToXml($document);
		
		if(!$this->out) {
			Sd_ErrorManager::raiseError(0, 'XSLT error: PHP5 xslt processor cannot handle files.');
		}
	}
	/**
	* Return PHP5 XSLT output
	*
	* @return    string
	*/
	public function output()
	{
		return $this->out;
	}
//[end]
}
?>
Return current item: Sourdough