Speed up development with full-stack environments for every branch.

Learn More

How to transform XSL to XML using PHP [XSLT]

508 Runs 2671 Views 706 Copies
Saved

Saved

gtsolutions 373

gtsolutions
published 4 years ago

<?php

/*
 * PHP XSL - How to transform XSL to XML using PHP
 */

// Load the XML source
$xml = new DOMDocument;
$xml->load('data/collection.xml');

$xsl = new DOMDocument;
$xsl->load('data/collection.xsl');

// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules

echo $proc->transformToXML($xml);

?>
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).