Lines 128-134
__PACKAGE__->mk_accessors(qw( do_not_return_source print_warns ));
Link Here
|
128 |
|
128 |
|
129 |
=head2 transform |
129 |
=head2 transform |
130 |
|
130 |
|
131 |
my $output= $xslt_engine->transform( $xml, $xsltfilename ); |
131 |
my $output= $xslt_engine->transform( $xml, $xsltfilename, [$parameters] ); |
132 |
if( $xslt_engine->err ) { |
132 |
if( $xslt_engine->err ) { |
133 |
#decide what to do on failure.. |
133 |
#decide what to do on failure.. |
134 |
} |
134 |
} |
Lines 144-150
__PACKAGE__->mk_accessors(qw( do_not_return_source print_warns ));
Link Here
|
144 |
=cut |
144 |
=cut |
145 |
|
145 |
|
146 |
sub transform { |
146 |
sub transform { |
147 |
my ( $self, $orgxml, $file ) = @_; |
147 |
my ( $self, $orgxml, $file, $parameters ) = @_; |
148 |
|
148 |
|
149 |
#Initialized yet? |
149 |
#Initialized yet? |
150 |
if ( !$self->{xslt_hash} ) { |
150 |
if ( !$self->{xslt_hash} ) { |
Lines 182-188
sub transform {
Link Here
|
182 |
return $retval; |
182 |
return $retval; |
183 |
} |
183 |
} |
184 |
my $str = eval { |
184 |
my $str = eval { |
185 |
my $result = $stsh->transform($source); |
185 |
#$parameters is an optional hashref that contains |
|
|
186 |
#key-value pairs to be sent to the XSLT. |
187 |
#Numbers may be bare but strings must be double quoted |
188 |
#(e.g. "'string'" or '"string"'). See XML::LibXSLT for |
189 |
#more details. |
190 |
|
191 |
#NOTE: Parameters are not cached. They are provided for |
192 |
#each different transform. |
193 |
my $result = $stsh->transform($source, %$parameters); |
186 |
$stsh->output_as_chars($result); |
194 |
$stsh->output_as_chars($result); |
187 |
}; |
195 |
}; |
188 |
if ($@) { |
196 |
if ($@) { |