Source for file XSLT.php
Documentation is available at XSLT.php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
* This source file is subject to version 2.1 of the GNU Lesser General Public
* License, that is bundled with this package in the file COPYING, available
* through the world wide web at the following URI:
* http://www.gnu.org/copyleft/lesser.html.
* @subpackage Presentation
* @author Alessandro Rossini <http://www.alessandrorossini.org>
* @author Graziano Liberati <http://www.liberati.org>
* @copyright 2004-2007 The ZNF Development Team
* @license LGPL License 2.1 <http://www.gnu.org/copyleft/lesser.html>
* @version SVN $Id: XSLT.php 43 2007-06-26 23:36:35Z aronnax $
* @link http://www.zeronotice.org
require_once('ZNF/Presentation/Render.php');
* <i>ZNF_Presentation_XSLT</i> class, extends the <i>ZNF_Presentation_Render</i> class and implements renderization with PHP <i>XSLTProcessor</i>.
* Render XML data using package or theme XSLT.
* @subpackage Presentation
* @author Alessandro Rossini <http://www.alessandrorossini.org>
* @author Graziano Liberati <http://www.liberati.org>
* @copyright 2004-2007 The ZNF Development Team
* @license LGPL License 2.1 <http://www.gnu.org/copyleft/lesser.html>
* @version SVN $Id: XSLT.php 43 2007-06-26 23:36:35Z aronnax $
* @link http://www.zeronotice.org
* The <i>XSLTProcessor</i>.
* @var XSLTProcessor $_xslt
* Where assigned XSLT parameters are kept.
* @var array $_xsltParams
* Constructs a new <i>ZNF_Presentation_XSLT</i> object and sets the internal properties with application settings.
* @param string $package Name of the package to which the xslt template
* refers, leave null this parameter to refer to the
* @param ZNF_Action_ActionMapping $mapping
public function __construct($package = null, $mapping = null)
$this->_xslt = new XSLTProcessor();
* Executes and returns the xslt template results.
* @param string $template File name of the xslt template
* @param string $xml The XML document
public function fetch($template, $xml = null)
$this->_xslt->importStylesheet(DOMDocument::load($template));
// change this istruction when the xsltprocessor->setParameter() is fixed to accept an array
$this->_xslt->setParameter('znf', $name, $value);
return $this->_xslt->transformToXml(DOMDocument::loadXML($xml));
* Executes and displays the xslt template results.
* @param string $template File name of the xslt template
* @param string $xml The XML document
public function display($template, $xml = null)
$this->_xslt->importStylesheet(DOMDocument::load($template));
// change this istruction when the xsltprocessor->setParameter() is fixed to accept an array
$this->_xslt->setParameter('znf', $name, $value);
echo $this->_xslt->transformToXml(DOMDocument::loadXML($xml));
* Assigns values to xslt template parameters.
* @param string $param The xslt template parameter name
* @param mixed $value The value to assign
public function assign($param, $value)
* Assign to xslt template the ZNF constants.
$this->assign('znf.baseHref', $constants['baseHref']);
$this->assign('znf.actionIndex', $constants['actionIndex']);
$this->assign('znf.moduleIndex', $constants['moduleIndex']);
$this->assign('znf.themePath', $constants['themePath']);
$this->assign('znf.packagePath', $constants['packagePath']);
$this->assign('znf.path', $constants['path']);
$this->assign('znf.nextPath', $constants['nextPath']);
$this->assign('znf.credits', $constants['credits']);
* Destroys the <i>ZNF_Presentation_XSLT</i> object.</>
* <i>ZNF_Presentation_XSLTException</i> is the exception type for the <i>ZNF_Presentation_XSLT</i> class.
* <i>ZNF_Presentation_XSLTException</i> extends the <i>Exception</i> class of PHP5.
* @subpackage Presentation
* @author Alessandro Rossini <http://www.alessandrorossini.org>
* @author Graziano Liberati <http://www.liberati.org>
* @copyright 2004-2007 The ZNF Development Team
* @license LGPL License 2.1 <http://www.gnu.org/copyleft/lesser.html>
* @version SVN $Id: XSLT.php 43 2007-06-26 23:36:35Z aronnax $
* @link http://www.zeronotice.org
|