diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:34:59 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:34:59 -0400 |
| commit | ce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (patch) | |
| tree | acdb9a8816483652a9db1a47db71df5df43707c5 /ext/xsl/tests | |
| parent | 10f5b47dc7c1cf2b9a00991629f43652710322d3 (diff) | |
| download | php-ce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61.tar.gz | |
Imported Upstream version 5.1.1upstream/5.1.1
Diffstat (limited to 'ext/xsl/tests')
| -rw-r--r-- | ext/xsl/tests/xslt012.phpt | 52 | ||||
| -rw-r--r-- | ext/xsl/tests/xslt012.xsl | 29 |
2 files changed, 81 insertions, 0 deletions
diff --git a/ext/xsl/tests/xslt012.phpt b/ext/xsl/tests/xslt012.phpt new file mode 100644 index 000000000..60387af4c --- /dev/null +++ b/ext/xsl/tests/xslt012.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test 12: Using Associative Array of Parameters +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +echo "Test 12: Using Associative Array of Parameters"; + +$dom = new domDocument; +$dom->load(dirname(__FILE__)."/xslt.xml"); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} + +$xsl = new domDocument; +$xsl->load(dirname(__FILE__)."/xslt012.xsl"); +if(!$xsl) { + echo "Error while parsing the document\n"; + exit; +} + +$proc = new xsltprocessor; +if(!$proc) { + echo "Error while making xsltprocessor object\n"; + exit; +} + + +$proc->importStylesheet($xsl); + +$parameters = Array( + 'foo' => 'barbar', + 'foo1' => 'test', + ); + +$proc->setParameter( "", $parameters); + +print "\n"; +print $proc->transformToXml($dom); +print "\n"; + + +--EXPECT-- +Test 12: Using Associative Array of Parameters +<?xml version="1.0" encoding="iso-8859-1"?> +<html><body>barbar +test +a1 b1 c1 <br/> +a2 c2 <br/> +ä3 b3 c3 <br/> +</body></html> diff --git a/ext/xsl/tests/xslt012.xsl b/ext/xsl/tests/xslt012.xsl new file mode 100644 index 000000000..eb0c491da --- /dev/null +++ b/ext/xsl/tests/xslt012.xsl @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- $Id: xslt012.xsl,v 1.1 2004/08/05 13:31:17 tony2001 Exp $ --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > + + <xsl:output method="xml" encoding="iso-8859-1" indent="no"/> + <xsl:param name="foo" select="'bar'"/> + <xsl:param name="foo1" select="'bar1'"/> + <xsl:template match="/"> + <html> + <body> + <xsl:value-of select="$foo"/><xsl:text> +</xsl:text> + <xsl:value-of select="$foo1"/><xsl:text> +</xsl:text> + <xsl:apply-templates select="/chapter/para/informaltable/tgroup/tbody/row"/> + </body> + </html> + </xsl:template> + + <xsl:template match="row"> + <xsl:for-each select="entry"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + <br/> <xsl:text> +</xsl:text> + + </xsl:template> +</xsl:stylesheet> |
