Check if XSLT Transformation failed

// Load XSL template
$xsl = newDOMDocument;
$xsl->load('stylesheet.xsl');
 
// Create new XSLTProcessor
$xslt = new XSLTProcessor();
// Load stylesheet
$xslt->importStylesheet($xsl);
 
// Load XML input file
$xml = new DOMDocument;
$xml->load('data.xml');
 
// Transform to string
$results = $xslt->transformToXML($xml);
 
// Transform to a file
$results = $xslt->transformToURI($xml, 'results.txt');
 
// Transform to DOM object
$results = $xslt->transformToDoc($xml);
 
if (false === ($results = $xslt->transformToXML($xml))) {
    // an error occurred
}

Share Article/Example:
  • DotNetKicks
  • DZone
  • StumbleUpon
  • Print
  • Add to favorites
  • Digg
  • del.icio.us
  • Twitter
  • Facebook
  • LinkedIn
  • Posterous
  • Slashdot

Filed Under: PHP XML Examples

RSSComments (0)

Trackback URL

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.