File: 08literal.t

package info (click to toggle)
libxml-libxslt-perl 2.003000-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 704 kB
  • sloc: xml: 2,181; perl: 1,227; ansic: 402; makefile: 24
file content (53 lines) | stat: -rw-r--r-- 1,079 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use strict;
use warnings;

# Should be 8.
use Test::More tests => 8;
use XML::LibXSLT;

my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();
# TEST
ok ($parser, '$parser was initted.');
# TEST
ok ($xslt, '$xslt was initted.');

my $source = $parser->parse_string(<<'EOT');
<?xml version="1.0" encoding="ISO-8859-1"?>
<document></document>
EOT

my $style = $parser->parse_string(<<'EOT');
<html
    xsl:version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<head>
</head>
</html>
EOT

# TEST
ok ($style, '$style is true.');
my $stylesheet = $xslt->parse_stylesheet($style);

# TEST
is ($stylesheet->output_method, 'xml',
    'output method is xml BEFORE processing');

# TEST
is ($stylesheet->media_type, 'text/xml',
    'media_type is text/xml BEFORE processing');

my $results = $stylesheet->transform($source);

# TEST
ok ($results, '$results are true.');

# TEST
is ($stylesheet->output_method, 'html',
    'output method is html AFTER processing');

# TEST
is ($stylesheet->media_type, 'text/html',
    'media_type is text/html AFTER processing');