Location: PHPKode > projects > The Online Web Library Site > towels/src/functions/xml.function.php
<?php
include_once('etc/vars.php');

// ******************************************************************
// XML FUNCTIONS
// Functions Available:
//  - transformXMLDocument
//    (Perform an XML transformation from XML and XSLT sources.)
// ******************************************************************


// **** transformXMLDocument Function ****
// Input: XML File, XSLT File
// Output: Transformed XML Data
// Description: Perform an XML transformation from XML and XSLT sources.
function transformXMLDocument($xmlFile, $xmlStyle)
{
  // Allocate a new XSLT processor
  $xsltProc = xslt_create();

  // Process the document, returning the result into the $data variable
  $data = xslt_process($xsltProc, $xmlFile, $xmlStyle);

  // If there is no output, display error message.
  if ($data == '')
  {
    $data = 'Unknown error building web page from XML & XSLT sources.  The reason is that ' .
            xslt_error($xsltProc) . ' and the error code is ' . xslt_errno($xsltProc);
  }
  
  // Kill XSLT processor
  xslt_free($xsltProc);

  return $data;
}

?>
Return current item: The Online Web Library Site