|
Lines 67-72
Koha::XSLT_Handler - Facilitate use of XSLT transformations
Link Here
|
| 67 |
If true, transform returns undef on failure. By default, it returns the |
67 |
If true, transform returns undef on failure. By default, it returns the |
| 68 |
original string passed. Errors are reported as described. |
68 |
original string passed. Errors are reported as described. |
| 69 |
|
69 |
|
|
|
70 |
=head2 print_warns |
| 71 |
|
| 72 |
If set, print error messages to STDERR. True by default. |
| 73 |
|
| 70 |
=head1 ERROR CODES |
74 |
=head1 ERROR CODES |
| 71 |
|
75 |
|
| 72 |
=head2 Error 1 |
76 |
=head2 Error 1 |
|
Lines 120-126
use XML::LibXSLT;
Link Here
|
| 120 |
use base qw(Class::Accessor); |
124 |
use base qw(Class::Accessor); |
| 121 |
|
125 |
|
| 122 |
__PACKAGE__->mk_ro_accessors(qw( err errstr )); |
126 |
__PACKAGE__->mk_ro_accessors(qw( err errstr )); |
| 123 |
__PACKAGE__->mk_accessors(qw( do_not_return_source )); |
127 |
__PACKAGE__->mk_accessors(qw( do_not_return_source print_warns )); |
| 124 |
|
128 |
|
| 125 |
=head2 transform |
129 |
=head2 transform |
| 126 |
|
130 |
|
|
Lines 229-234
sub _init {
Link Here
|
| 229 |
|
233 |
|
| 230 |
$self->_set_error; |
234 |
$self->_set_error; |
| 231 |
$self->{xslt_hash}={}; |
235 |
$self->{xslt_hash}={}; |
|
|
236 |
$self->{print_warns}=1 unless exists $self->{print_warns}; |
| 232 |
$self->{do_not_return_source}=0 unless exists $self->{do_not_return_source}; |
237 |
$self->{do_not_return_source}=0 unless exists $self->{do_not_return_source}; |
| 233 |
#by default we return source on a failing transformation |
238 |
#by default we return source on a failing transformation |
| 234 |
#but it could be passed at construction time already |
239 |
#but it could be passed at construction time already |
|
Lines 303-308
sub _set_error {
Link Here
|
| 303 |
if( $addmsg ) { |
308 |
if( $addmsg ) { |
| 304 |
$self->{errstr}.= " $addmsg"; |
309 |
$self->{errstr}.= " $addmsg"; |
| 305 |
} |
310 |
} |
|
|
311 |
|
| 312 |
warn $self->{errstr} if $self->{print_warns}; |
| 306 |
return; |
313 |
return; |
| 307 |
} |
314 |
} |
| 308 |
|
315 |
|
| 309 |
- |
|
|