| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package XML::CompareML::HTML; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
52602
|
use strict; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
87
|
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
73
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
15
|
use Carp; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
280
|
|
|
7
|
3
|
|
|
3
|
|
17
|
use File::Spec; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
62
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
5998
|
use CGI (); |
|
|
3
|
|
|
|
|
66548
|
|
|
|
3
|
|
|
|
|
83
|
|
|
10
|
3
|
|
|
3
|
|
3767
|
use XML::LibXSLT; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use XML::CompareML::ConfigData; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use base 'XML::CompareML::Base'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw( |
|
17
|
|
|
|
|
|
|
_data_dir |
|
18
|
|
|
|
|
|
|
_xml_parser |
|
19
|
|
|
|
|
|
|
_stylesheet |
|
20
|
|
|
|
|
|
|
)); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _initialize |
|
23
|
|
|
|
|
|
|
{ |
|
24
|
|
|
|
|
|
|
my $self = shift; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$self->SUPER::_initialize(@_); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my (%args) = (@_); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $data_dir = $args{'data_dir'} || |
|
31
|
|
|
|
|
|
|
XML::CompareML::ConfigData->config('extradata_install_path')->[0]; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$self->_data_dir($data_dir); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$self->_xml_parser(XML::LibXML->new()); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $xslt = XML::LibXSLT->new(); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $style_doc = $self->_xml_parser()->parse_file( |
|
40
|
|
|
|
|
|
|
File::Spec->catfile( |
|
41
|
|
|
|
|
|
|
$self->_data_dir(), |
|
42
|
|
|
|
|
|
|
"compare-ml.xslt" |
|
43
|
|
|
|
|
|
|
), |
|
44
|
|
|
|
|
|
|
); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$self->_stylesheet($xslt->parse_stylesheet($style_doc)); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
return 0; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 $to-html->process() |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Do the actual processing using the XSLT stylesheet. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub process |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
|
|
|
|
|
|
my ($self, $args) = @_; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=begin RELAX_NG_VALIDATION |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $ret_code; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
eval |
|
66
|
|
|
|
|
|
|
{ |
|
67
|
|
|
|
|
|
|
$ret_code = $self->_rng()->validate($source_dom); |
|
68
|
|
|
|
|
|
|
}; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
if (defined($ret_code) && ($ret_code == 0)) |
|
71
|
|
|
|
|
|
|
{ |
|
72
|
|
|
|
|
|
|
# It's OK. |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
else |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
|
|
|
|
|
|
confess "RelaxNG validation failed [\$ret_code == $ret_code ; $@]"; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=end RELAX_NG_VALIDATION |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
my $stylesheet = $self->_stylesheet(); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $results = $stylesheet->transform($self->dom()); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
print {*{$self->{o}}} $stylesheet->output_string($results); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
return 0; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 NAME |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
XML::CompareML::HTML - convert CompareML to XHTML |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
See L. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 METHODS |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 $converter->gen_systems_list({output_handle => \*STDOUT}) |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Generates a list of li's with links to the systems, not unlike: |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
L |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub gen_systems_list |
|
113
|
|
|
|
|
|
|
{ |
|
114
|
|
|
|
|
|
|
my ($self, %args) = @_; |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
my $fh = $args{output_handle}; |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my @implementations = $self->_findnodes("/comparison/meta/implementations/impl"); |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
foreach my $impl (@implementations) |
|
121
|
|
|
|
|
|
|
{ |
|
122
|
|
|
|
|
|
|
my $name = $self->_impl_get_tag_text($impl, "name"); |
|
123
|
|
|
|
|
|
|
my $url = $self->_impl_get_tag_text($impl, "url"); |
|
124
|
|
|
|
|
|
|
my $fullname = $self->_impl_get_tag_text($impl, "fullname"); |
|
125
|
|
|
|
|
|
|
my $vendor = $self->_impl_get_tag_text($impl, "vendor"); |
|
126
|
|
|
|
|
|
|
if (!defined($url)) |
|
127
|
|
|
|
|
|
|
{ |
|
128
|
|
|
|
|
|
|
die "URL not specified for implementation $name."; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
print {$fh} qq{} . |
|
131
|
|
|
|
|
|
|
CGI::escapeHTML(defined($fullname) ? $fullname : $name) . |
|
132
|
|
|
|
|
|
|
qq{} . (defined($vendor) ? " by $vendor" : "") . |
|
133
|
|
|
|
|
|
|
qq{\n} |
|
134
|
|
|
|
|
|
|
; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 AUTHOR |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Shlomi Fish, L. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
L |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Copyright 2004, Shlomi Fish. All rights reserved. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
You can use, modify and distribute this module under the terms of the MIT X11 |
|
151
|
|
|
|
|
|
|
license. ( L ). |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; |