Location: PHPKode > projects > Sourdough > sourdough/Sd_Xslt/Sd_Xslt.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
*
* @package      sourdough
* @subpackage   xslt
* @author       Philip Iezzi <hide@address.com>
* @author       based on XSLT class http://www.neokraft.net, original author: Olivier Meunier
* @copyright    Copyright (c) 2001-2007 PHPEE.COM
* @license      http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
* @version      $Id: Sd_Xslt.class.php 3003 2007-12-08 11:05:17Z piezzi $
*/
abstract class Sd_Xslt {
//[start] Local Variables
	/**
	* Sourdough core object
	*
	* @var      Sourdough    $Sourdough
	*/
	protected $Sourdough;
	/**
	* Configuration
	*
	* @var      array    $conf
	*/
	protected $conf;
	/**
	* XML file
	*
	* @var      string    $XML
	*/
	protected $XML;
	/**
	* XSL file
	*
	* @var      string    $XSL
	*/
	protected $XSL;
	/**
	* File content
	*
	* @var      boolean   $is_content
	*/
	protected $is_content;
	/**
	* XSL parameters
	*
	* @var      string    $params
	*/
	protected $params;
	/**
	* XSLT output
	*
	* @var      string   $out
	*/
	protected $out;
//[end]

//[start] Constructor	
	/**
	* Sd_Xslt constructor
	*
	* @return   void
	*/
	public function __construct()
	{
		// load global config into local array
		$this->conf = $this->Sourdough->getConf('xslt');
	}
//[end]

//[start] Public Methods
	/**
	* XSLT load files, engine
	*
	* @param    string     $XML          path of XML file
	* @param    string     $XSL          path of XSL file
	* @param    boolean    $is_content   if true, handle $XML and $XSL as file content
	* @return   void
	*/
	public function load($XML, $XSL, $is_content = false)
	{
		$this->_init();
		$this->XML = $XML;
		$this->XSL = $XSL;
		$this->is_content = $is_content;
		
		$this->init();
	}
	/**
	* Turn error handling off
	*
	* @return    void
	*/
	public function errorsOff()
	{
		$this->conf['show_error'] = false;
	}
	/**
	* add parameters
	*
	* Pass parameters to Sablotron which will be integrated as variables 
	* into XSL.
	*
	* @param     array    $params        parameters
	* @return    void
	*/
	public function setParams($params)
	{
		if(is_array($params)) {
			$this->params = $params;
		}
	}
	/**
	* Transformation
	*
	* Main XSL Transformation
	*
	* @return    void
	*/
	public abstract function transform();
	/**
	* Return the XSLT result
	*
	* @return    string      result
	*/
	public abstract function output();
//[end]

//[start] Protected/Private Methods
	/**
	* Global initialization
	*
	* @return         void
	*/
	private function _init()
	{
		$this->params = array();
	}
	/**
	* Transformation
	*
	* Main XSL Transformation
	*
	* @return    void
	*/
	protected function init()
	{
		return true;
	}
	/**
	* Close the parser
	*
	* return            void
	*/
	protected function close()
	{
		return true;
	}
//[end]
}
?>
Return current item: Sourdough