xslt012.phpt 942 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --TEST--
  2. Test 12: Using Associative Array of Parameters
  3. --EXTENSIONS--
  4. xsl
  5. --FILE--
  6. <?php
  7. echo "Test 12: Using Associative Array of Parameters";
  8. $dom = new domDocument;
  9. $dom->load(__DIR__."/xslt.xml");
  10. if(!$dom) {
  11. echo "Error while parsing the document\n";
  12. exit;
  13. }
  14. $xsl = new domDocument;
  15. $xsl->load(__DIR__."/xslt012.xsl");
  16. if(!$xsl) {
  17. echo "Error while parsing the document\n";
  18. exit;
  19. }
  20. $proc = new xsltprocessor;
  21. if(!$proc) {
  22. echo "Error while making xsltprocessor object\n";
  23. exit;
  24. }
  25. $proc->importStylesheet($xsl);
  26. $parameters = Array(
  27. 'foo' => 'barbar',
  28. 'foo1' => 'test',
  29. );
  30. $proc->setParameter( "", $parameters);
  31. print "\n";
  32. print $proc->transformToXml($dom);
  33. print "\n";
  34. --EXPECT--
  35. Test 12: Using Associative Array of Parameters
  36. <?xml version="1.0" encoding="iso-8859-1"?>
  37. <html><body>barbar
  38. test
  39. a1 b1 c1 <br/>
  40. a2 c2 <br/>
  41. ä3 b3 c3 <br/>
  42. </body></html>