File: xml-grammar-failures.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 (42 lines) | stat: -rw-r--r-- 1,086 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
#!/usr/bin/perl

use strict;
use warnings;

# Failures with doing this were reported against several XML::Grammar::*
# modules on various systems, and we want to catch them as soon as we can.
#
# See for example:
# http://www.cpantesters.org/cpan/report/b0e211b6-8b4d-11e3-9847-e214e1bfc7aa

use File::Spec;

use Test::More tests => 1;

use XML::LibXSLT;
use XML::LibXML;

{
    my $xslt = XML::LibXSLT->new();

    my $input_fn = File::Spec->catfile(
        File::Spec->curdir(), "t", "data", "perl-begin-page.xml-grammar-vered.xml",
    );

    my $xslt_fn = File::Spec->catfile(
        File::Spec->curdir(), "t", "data", "vered-xml-to-docbook.xslt",
    );

    my $source = XML::LibXML->load_xml(location => $input_fn);
    my $style_doc = XML::LibXML->load_xml(location=>$xslt_fn, no_cdata=>1);

    my $stylesheet = $xslt->parse_stylesheet($style_doc);

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

    # TEST
    like (scalar($stylesheet->output_as_bytes($results)),
        qr/<db:listitem/,
        "Rudimentary XSLT test just to make sure we reached here.",
    );
}