You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by da...@apache.org on 2002/01/30 19:17:21 UTC

cvs commit: xml-axkit/lib/Apache/AxKit/Language LibXSLT.pm Sablot.pm

darobin     02/01/30 10:17:21

  Modified:    lib/Apache/AxKit Language.pm
               lib/Apache/AxKit/Language LibXSLT.pm Sablot.pm
  Log:
  patches for XSLT params that should have been in eons ago
  
  Revision  Changes    Path
  1.2       +23 -1     xml-axkit/lib/Apache/AxKit/Language.pm
  
  Index: Language.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Language.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Language.pm	13 Jan 2002 20:45:11 -0000	1.1
  +++ Language.pm	30 Jan 2002 18:17:21 -0000	1.2
  @@ -1,4 +1,4 @@
  -# $Id: Language.pm,v 1.1 2002/01/13 20:45:11 matts Exp $
  +# $Id: Language.pm,v 1.2 2002/01/30 18:17:21 darobin Exp $
   
   package Apache::AxKit::Language;
   
  @@ -19,6 +19,28 @@
   }
   
   sub stylesheet_exists { 1; }
  +
  +sub get_params {
  +    my $class = shift;
  +    my $r = shift;
  +
  +    my $cgi = Apache::Request->instance($r);
  +    my @xslt_params;
  +    if (!$r->notes('disable_xslt_params')) {
  +        my $cgi = Apache::Request->instance($r);
  +        @xslt_params = map { $_ => $cgi->param($_) } $cgi->param;
  +        if (ref($r->pnotes('extra_xslt_params')) eq 'ARRAY') {
  +            push @xslt_params, @{$r->pnotes('extra_xslt_params')};
  +        }
  +        elsif (ref($r->pnotes('extra_xslt_params')) eq 'CODE') {
  +            $r->pnotes('extra_xslt_params')->($r, $cgi, \@xslt_params);
  +        }
  +        elsif (ref($r->pnotes('extra_xslt_params')) eq 'HASH') {
  +            push @xslt_params, %{$r->pnotes('extra_xslt_params')};
  +        }
  +    }
  +    return @xslt_params;
  +}
   
   1;
   __END__
  
  
  
  1.2       +3 -5      xml-axkit/lib/Apache/AxKit/Language/LibXSLT.pm
  
  Index: LibXSLT.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Language/LibXSLT.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LibXSLT.pm	13 Jan 2002 20:45:11 -0000	1.1
  +++ LibXSLT.pm	30 Jan 2002 18:17:21 -0000	1.2
  @@ -1,4 +1,4 @@
  -# $Id: LibXSLT.pm,v 1.1 2002/01/13 20:45:11 matts Exp $
  +# $Id: LibXSLT.pm,v 1.2 2002/01/30 18:17:21 darobin Exp $
   
   package Apache::AxKit::Language::LibXSLT;
   
  @@ -109,10 +109,8 @@
       }
   
       # get request form/querystring parameters
  -    my @params;
  -    my $cgi = Apache::Request->instance($r);
  -    @params = fixup_params(map { $_ => $cgi->param($_) } $cgi->param);
  -    
  +    my @params = fixup_params($class->get_params($r));
  +
       AxKit::Debug(7, "[LibXSLT] performing transformation");
   
       my $results = $stylesheet->transform($xml_doc, @params);
  
  
  
  1.2       +3 -7      xml-axkit/lib/Apache/AxKit/Language/Sablot.pm
  
  Index: Sablot.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Language/Sablot.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Sablot.pm	13 Jan 2002 20:45:11 -0000	1.1
  +++ Sablot.pm	30 Jan 2002 18:17:21 -0000	1.2
  @@ -1,4 +1,4 @@
  -# $Id: Sablot.pm,v 1.1 2002/01/13 20:45:11 matts Exp $
  +# $Id: Sablot.pm,v 1.2 2002/01/30 18:17:21 darobin Exp $
   
   package Apache::AxKit::Language::Sablot;
   
  @@ -40,12 +40,8 @@
       my $retcode;
   
       # get request form/querystring parameters
  -    my $cgi = Apache::Request->instance($r);
  -    my @xslt_params;
  -    foreach my $param ($cgi->param) {
  -        push @xslt_params, $param, $cgi->param($param);
  -    }
  -    
  +    my @xslt_params = $class->get_params($r);
  +
       # get and register handler object
       $handler->set_apache($r);
       $handler->set_ext_ent_handler($xml->get_ext_ent_handler());