| 1 |
|
| 2 |
################################################################################### |
| 3 |
# |
| 4 |
# Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de |
| 5 |
# Embperl - Copyright (c) 2008-2014 Gerald Richter |
| 6 |
# |
| 7 |
# You may distribute under the terms of either the GNU General Public |
| 8 |
# License or the Artistic License, as specified in the Perl README file. |
| 9 |
# |
| 10 |
# THIS PACKAGE IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESS OR |
| 11 |
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 12 |
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
# |
| 14 |
# $Id: XSLT.pm 1578075 2014-03-16 14:01:14Z richter $ |
| 15 |
# |
| 16 |
################################################################################### |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
package Embperl::Recipe::XSLT ; |
| 21 |
|
| 22 |
use strict ; |
| 23 |
use vars qw{@ISA} ; |
| 24 |
|
| 25 |
use Embperl::Recipe ; |
| 26 |
|
| 27 |
@ISA = ('Embperl::Recipe') ; |
| 28 |
|
| 29 |
# --------------------------------------------------------------------------------- |
| 30 |
# |
| 31 |
# Create a new recipe by converting request parameter |
| 32 |
# |
| 33 |
# --------------------------------------------------------------------------------- |
| 34 |
|
| 35 |
|
| 36 |
sub get_recipe |
| 37 |
|
| 38 |
{ |
| 39 |
my ($class, $r, $recipe, $src) = @_ ; |
| 40 |
|
| 41 |
my $param = $r -> component -> param ; |
| 42 |
my $config = $r -> component -> config ; |
| 43 |
my $xsltproc = $config -> xsltproc ; |
| 44 |
my @recipe ; |
| 45 |
|
| 46 |
my @stylesheet = |
| 47 |
( |
| 48 |
{ type => 'file', 'filename' => $config -> xsltstylesheet, }, |
| 49 |
{ type => $xsltproc . '-compile-xsl', cache => 1 }, |
| 50 |
) ; |
| 51 |
|
| 52 |
if (!$src) |
| 53 |
{ |
| 54 |
push @recipe, {'type' => ref ($param -> input)?'memory':'file' } ; |
| 55 |
} |
| 56 |
else |
| 57 |
{ |
| 58 |
push @recipe, ref $src eq 'ARRAY'?@$src:$src ; |
| 59 |
} |
| 60 |
|
| 61 |
push @recipe, {'type' => $xsltproc . '-parse-xml', } ; |
| 62 |
push @recipe, {'type' => $xsltproc, stylesheet => \@stylesheet } ; |
| 63 |
|
| 64 |
return \@recipe ; |
| 65 |
} |
| 66 |
|
| 67 |
1 ; |
| 68 |
|
| 69 |
|
| 70 |
__END__ |
| 71 |
|
| 72 |
=pod |
| 73 |
|
| 74 |
=head1 NAME |
| 75 |
|
| 76 |
Embperl::Recipe::XSLT - recipe for performing an XSLT transformation |
| 77 |
|
| 78 |
=head1 SYNOPSIS |
| 79 |
|
| 80 |
|
| 81 |
=head1 DESCRIPTION |
| 82 |
|
| 83 |
This recipe does an XSLT transformation. |
| 84 |
|
| 85 |
=head1 Author |
| 86 |
|
| 87 |
G. Richter (richter at embperl dot org) |
| 88 |
|
| 89 |
=head1 See Also |
| 90 |
|
| 91 |
L<Embperl::Recipe|EmbperlRecipe.pod> |
| 92 |
|
| 93 |
L<Embperl::Recipe::EmbperlXSLT|EmbperlRecipe/XSLT.pod> |