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