# Test that attributes work # $Id: attributes.t,v 1.4 2004/02/17 10:44:29 gellyfish Exp $ use Test::More tests => 5; use strict; use vars qw($DEBUGGING); $DEBUGGING = 0; use_ok('XML::XSLT'); eval { my $stylesheet = <

fooFoo

EOS my $xml =<

Some Random text

EOX my $expected = qq{

Foo

}; my $parser = XML::XSLT->new(\$stylesheet,debug => $DEBUGGING); $parser->transform(\$xml); my $outstr = $parser->toString(); warn "$outstr\n" if $DEBUGGING; $parser->dispose(); die "$outstr ne $expected\n" unless $outstr eq $expected; }; ok(!$@, "xsl:attribute works"); eval { my $stylesheet =< This is a summary Foo EOS my $xml =<

Some Random text

EOX my $parser = XML::XSLT->new(\$stylesheet,debug => $DEBUGGING); $parser->transform(\$xml); my $outstr = $parser->toString() ; my $expected =<

Foo

EOE chomp($expected); warn "$outstr\n" if $DEBUGGING; die "$outstr ne $expected\n" unless $outstr eq $expected; $parser->dispose(); }; warn "$@\n" if $DEBUGGING; ok(!$@, "attribute-set in element"); eval { my $stylesheet =< underline black 14pt Foo EOS my $xml =<

Some Random text

EOX my $parser = XML::XSLT->new(\$stylesheet,debug => $DEBUGGING); $parser->transform(\$xml); my $outstr = $parser->toString() ; my $expected =<Foo

EOE chomp($expected); warn "$outstr\n" if $DEBUGGING; die "$outstr ne $expected\n" unless $outstr =~ /$expected/; $parser->dispose(); }; warn "$@\n" if $DEBUGGING; ok(!$@, "nested attribute-sets"); eval { my $stylesheet =< http://www.w3.org/1999/XSL/Transform value EOS my $xml = ''; my $parser = XML::XSLT->new(\$stylesheet,debug => $DEBUGGING); $parser->transform(\$xml); my $outstr = $parser->toString() ; warn "$outstr\n" if $DEBUGGING; die "$outstr contains xmlns declaration\n" if $outstr =~ /xmlns:xsl/ ; $parser->dispose(); }; warn "$@\n" if $DEBUGGING; ok(!$@, "do not output namespace declaration");