PHP Classes

XSLT PHP Template Engine: Process templates using XSLT

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-06-02 (4 months ago) RSS 2.0 feedNot enough user ratingsTotal: 246 All time: 7,939 This week: 138Up
Version License PHP version Categories
xslt-php-template 1.4GNU General Publi...5.3.0XML, PHP 5, Templates
Description 

Author

This class can process templates using XSLT.

It can take parameter values and replace them in template files using XSLT to generate the processed template output when give XML style sheets.

Picture of Pierre-Henry Soria
  Performance   Level  
Name: Pierre-Henry Soria <contact>
Classes: 43 packages by
Country: United Kingdom
Age: 32
All time rank: 39016 in United Kingdom
Week rank: 2 Up1 in United Kingdom Up
Innovation award
Innovation award
Nominee: 16x

Winner: 3x

Example

<?php
/**
 * @title Example file.
 *
 * @author Pierre-Henry Soria <ph7software@gmail.com>
 * @copyright (c) 2012, Pierre-Henry Soria. All Rights Reserved.
 * @license GNU General Public License.
 */

// Set a global namespace for the example file.
namespace PH7;
define('PH7', 1);

// Loading files necessary for the example with autoload file
require '../Library/_autoload.inc.php';

// Get the namespace
use PH7\Library\PH7Xsl\PH7Xsl;

try
{
   
$oXslTpl = new PH7Xsl(__DIR__ . '/persons.xsl');

   
$aVars = array(
       
'meta' => array(
           
'title' => 'Example to XSLT PHP Template Engine',
           
'description' => 'This is a simple but effective and powerful template engine running PHP with XSLT. With XSLT syntax, your template code and may be portable to virtually any programming language.',
           
'keywords' => 'PHP, XSLT, template',
        ),
       
'info' => array(
           
'lang' => 'en-US',
           
'heading1' => 'Simple XSLT PHP Engine',
           
'copyright-link' => 'http://ph-7.github.com',
           
'copyright-title-link' => 'pH7',
        )
    );

    foreach(
$aVars as $aStr)
       
$oXslTpl->setParam($aStr);

   
$aPersons = array(
       
1 => array('name' => 'Gayen', 'first-name' => 'Mark', 'description' => 'What are you doing tonight?, I go out with friends ;-)'),
       
2 => array('name' => 'Roksen', 'first-name' => 'Katin', 'description' => 'Hi, I\'m a nice person, and you?'),
       
3 => array('name' => 'Gansen', 'first-name' => 'Matthew', 'description' => 'Looking for nothing ...'),
       
4 => array('name' => 'Korsan', 'first-name' => 'Alexander', 'description' => 'I love spaghetti!'),
       
5 => array('name' => 'Frey', 'first-name' => 'Matt', 'description' => 'It seems that tomorrow I would be happy ...'),
       
6 => array('name' => 'Admin', 'first-name' => 'Gayen', 'description' => 'I\'m the king ... :D')
    );

    foreach(
$aPersons as $aPerson)
       
$oXslTpl->generateXMLNode($aPerson, 'persons');

   
$oXslTpl->render(); // Display

}
catch(\
Exception $oE)
{
    echo
'<p><b>Exception launched!</b><br /><br />' .
   
'Message: ' . $oE->getMessage() . '<br />' .
   
'File: ' . $oE->getFile() . '<br />' .
   
'Line: ' . $oE->getLine() . '<br />' .
   
'Trace: <p/><pre>' . $oE->getTraceAsString() . '</pre>';
}


Screenshots  
  • example-of-PH7Xsl-XSLT-PHP-template-engine.png
  Files folder image Files  
File Role Description
Files folder imageExample (5 files, 1 directory)
Files folder imageLibrary (1 file, 1 directory)
Accessible without login Plain text file LICENSE.txt Lic. License
Accessible without login Plain text file README.md Doc. Doc

  Files folder image Files  /  Example  
File Role Description
Files folder imagescreenshot (1 file)
  Accessible without login Plain text file head.inc.xsl Data Auxiliary data
  Accessible without login Plain text file index.php Example Example script
  Accessible without login Plain text file persons.xsl Data Auxiliary data
  Accessible without login Plain text file style.css Data Auxiliary data
  Accessible without login Plain text file _layout.xsl Data Auxiliary data

  Files folder image Files  /  Example  /  screenshot  
File Role Description
  Accessible without login Image file demo-of-PH7Xsl-XSL...template-engine.png Data Auxiliary data

  Files folder image Files  /  Library  
File Role Description
Files folder imagePH7Xsl (2 files)
  Plain text file _autoload.inc.php Class Class source

  Files folder image Files  /  Library  /  PH7Xsl  
File Role Description
  Plain text file Exception.class.php Class Class source
  Plain text file PH7Xsl.class.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 91%
Total:246
This week:0
All time:7,939
This week:138Up