Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2. //Get the race id selected by the user - to be passed to xslt
  3. $id = $_GET["raceid"];
  4.  
  5. //Process the data using XSLT Processor
  6.  
  7. //Create an instance of the XSLT Processor
  8. $xp = new XsltProcessor();
  9.  
  10. //Create a DOM document and load the XSL
  11. $xsl = new DomDocument;
  12. $xsl->load('resx/resultDetails.xsl');
  13.  
  14. //Import the XSL into the processor
  15. $xp->importStylesheet($xsl);
  16.  
  17. //Create a DOM document and load the XML
  18. $xml_doc = new DomDocument;
  19. $xml_doc->load('resx/F1Results.xml');
  20.  
  21. $xp->setParameter($namespace, 'id', $id);
  22. //Pass the ID Parameter
  23.  
  24. //Transform the XML into HTMl using XSL Rules
  25. if ($html = $xp->transformToXML($xml_doc))
  26. {
  27.     echo $html;
  28. }
  29. else
  30. {
  31.     trigger_error('XSL transform failed.',E_USER_ERROR);
  32. }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement