r21541 - in /branches/upstream/libxml-filter-xslt-perl: ./ current/ current/lib/ current/lib/XML/ current/lib/XML/Filter/ current/lib/XML/Filter/XSLT/ current/t/

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sun Jun 15 15:57:17 UTC 2008


Author: gregoa
Date: Sun Jun 15 15:57:17 2008
New Revision: 21541

URL: http://svn.debian.org/wsvn/?sc=1&rev=21541
Log:
[svn-inject] Installing original source of libxml-filter-xslt-perl

Added:
    branches/upstream/libxml-filter-xslt-perl/
    branches/upstream/libxml-filter-xslt-perl/current/
    branches/upstream/libxml-filter-xslt-perl/current/Changes
    branches/upstream/libxml-filter-xslt-perl/current/MANIFEST
    branches/upstream/libxml-filter-xslt-perl/current/MANIFEST.SKIP
    branches/upstream/libxml-filter-xslt-perl/current/Makefile.PL
    branches/upstream/libxml-filter-xslt-perl/current/README
    branches/upstream/libxml-filter-xslt-perl/current/lib/
    branches/upstream/libxml-filter-xslt-perl/current/lib/XML/
    branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/
    branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT/
    branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT.pm
    branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT/LibXSLT.pm
    branches/upstream/libxml-filter-xslt-perl/current/t/
    branches/upstream/libxml-filter-xslt-perl/current/t/00basic.t
    branches/upstream/libxml-filter-xslt-perl/current/t/01filter.t

Added: branches/upstream/libxml-filter-xslt-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-filter-xslt-perl/current/Changes?rev=21541&op=file
==============================================================================
--- branches/upstream/libxml-filter-xslt-perl/current/Changes (added)
+++ branches/upstream/libxml-filter-xslt-perl/current/Changes Sun Jun 15 15:57:17 2008
@@ -1,0 +1,9 @@
+
+0.03
+    - Add set_stylesheet_uri (Kip Hampton)
+
+0.02
+    - Added set_handler for SAX::Machines compatibility
+
+0.01 
+    - Initial release

Added: branches/upstream/libxml-filter-xslt-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-filter-xslt-perl/current/MANIFEST?rev=21541&op=file
==============================================================================
--- branches/upstream/libxml-filter-xslt-perl/current/MANIFEST (added)
+++ branches/upstream/libxml-filter-xslt-perl/current/MANIFEST Sun Jun 15 15:57:17 2008
@@ -1,0 +1,9 @@
+Changes
+MANIFEST
+MANIFEST.SKIP
+Makefile.PL
+README
+lib/XML/Filter/XSLT.pm
+lib/XML/Filter/XSLT/LibXSLT.pm
+t/00basic.t
+t/01filter.t

Added: branches/upstream/libxml-filter-xslt-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-filter-xslt-perl/current/MANIFEST.SKIP?rev=21541&op=file
==============================================================================
--- branches/upstream/libxml-filter-xslt-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libxml-filter-xslt-perl/current/MANIFEST.SKIP Sun Jun 15 15:57:17 2008
@@ -1,0 +1,13 @@
+CVS/.*
+\.bak$
+\.sw[a-z]$
+\.tar$
+\.tgz$
+\.tar\.gz$
+^mess/
+^tmp/
+^blib/
+^Makefile$
+^Makefile\.[a-z]+$
+^pm_to_blib$
+~$

Added: branches/upstream/libxml-filter-xslt-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-filter-xslt-perl/current/Makefile.PL?rev=21541&op=file
==============================================================================
--- branches/upstream/libxml-filter-xslt-perl/current/Makefile.PL (added)
+++ branches/upstream/libxml-filter-xslt-perl/current/Makefile.PL Sun Jun 15 15:57:17 2008
@@ -1,0 +1,13 @@
+use ExtUtils::MakeMaker;
+WriteMakefile(
+    NAME           => 'XML::Filter::XSLT',
+    VERSION_FROM   => 'lib/XML/Filter/XSLT.pm',
+    PREREQ_PM      => {
+        XML::SAX => 0.03, 
+        XML::LibXSLT => 1.31,
+        XML::SAX::Writer => 0.20,
+    },
+    ABSTRACT_FROM  => 'lib/XML/Filter/XSLT.pm',
+    AUTHOR         => 'Matt Sergeant <matt at sergeant.org>',
+);
+

Added: branches/upstream/libxml-filter-xslt-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-filter-xslt-perl/current/README?rev=21541&op=file
==============================================================================
--- branches/upstream/libxml-filter-xslt-perl/current/README (added)
+++ branches/upstream/libxml-filter-xslt-perl/current/README Sun Jun 15 15:57:17 2008
@@ -1,0 +1,15 @@
+XML::Filter::XSLT
+=================
+
+A simple XSLT SAX2 filter. It uses any available XSLT processor
+on your system that we can use in some SAXy way. Currently this
+is just XML::LibXSLT (which we use to build a DOM tree), but we
+expect more processors will be added over time.
+
+INSTALLATION:
+
+ $ perl Makefile.PL
+ $ make
+ $ make test
+ $ su
+ $ make install

Added: branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT.pm?rev=21541&op=file
==============================================================================
--- branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT.pm (added)
+++ branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT.pm Sun Jun 15 15:57:17 2008
@@ -1,0 +1,48 @@
+# $Id: XSLT.pm,v 1.3 2002/02/25 13:09:38 matt Exp $
+
+package XML::Filter::XSLT;
+use strict;
+use vars qw($VERSION);
+
+$VERSION = 0.03;
+
+sub new {
+    my $class = shift;
+    # try and load XSLT engines
+    eval {
+        require XML::Filter::XSLT::LibXSLT;
+    };
+    if (!$@) {
+        return XML::Filter::XSLT::LibXSLT->new(@_);
+    }
+
+    die "No XSLT engines available";
+}
+
+1;
+__END__
+
+=head1 NAME
+
+XML::Filter::XSLT - XSLT as a SAX Filter
+
+=head1 SYNOPSIS
+
+  use XML::SAX::ParserFactory;
+  use XML::Filter::XSLT;
+  use XML::SAX::Writer;
+
+  my $writer = XML::SAX::Writer->new();
+  my $filter = XML::Filter::XSLT->new(Handler => $writer);
+  my $parser = XML::SAX::ParserFactory->parser(
+                  Handler => $filter);
+  $filter->set_stylesheet_uri("foo.xsl");
+  $parser->parse_uri("foo.xml");
+
+=head1 DESCRIPTION
+
+=head1 AUTHOR
+
+=head1 LICENSE
+
+=cut

Added: branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT/LibXSLT.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT/LibXSLT.pm?rev=21541&op=file
==============================================================================
--- branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT/LibXSLT.pm (added)
+++ branches/upstream/libxml-filter-xslt-perl/current/lib/XML/Filter/XSLT/LibXSLT.pm Sun Jun 15 15:57:17 2008
@@ -1,0 +1,93 @@
+# $Id: LibXSLT.pm,v 1.4 2002/02/25 13:08:55 matt Exp $
+
+package XML::Filter::XSLT::LibXSLT;
+use strict;
+
+use XML::LibXSLT;
+use XML::LibXML::SAX::Builder;
+use XML::LibXML::SAX::Parser;
+
+use vars qw(@ISA);
+ at ISA = qw(XML::LibXML::SAX::Builder);
+
+sub new {
+    my $class = shift;
+    my %params = @_;
+    my $self = bless \%params, $class;
+    return $self;
+}
+
+sub set_stylesheet_uri {
+    # <ubu> hey look, now it does what the synopsis says it can.. ;->
+    my $self = shift;
+    my $uri = shift;
+    $self->{Source}{SystemId} = $uri;
+}
+
+sub start_document {
+    my $self = shift;
+
+    # copy logic from XML::SAX::Base for getting "something" out of Source key.
+    # parse stylesheet
+    # store
+    # return
+    my $parser = XML::LibXML->new;
+    my $styledoc;
+    if (defined $self->{Source}{CharacterStream}) {
+        die "CharacterStream is not supported";
+    }
+    elsif (defined $self->{Source}{ByteStream}) {
+        $styledoc = $parser->parse_fh($self->{Source}{ByteStream}, $self->{Source}{SystemId} || '');
+    }
+    elsif (defined $self->{Source}{String}) {
+        $styledoc = $parser->parse_string($self->{Source}{String}, $self->{Source}{SystemId} || '');
+    }
+    elsif (defined $self->{Source}{SystemId}) {
+        $styledoc = $parser->parse_file($self->{Source}{SystemId});
+    }
+    
+    if (!$styledoc) {
+        die "Could not create stylesheet DOM";
+    }
+
+    $self->{StylesheetDOM} = $styledoc;
+    $self->SUPER::start_document(@_)
+
+}
+
+sub end_document {
+    my $self = shift;
+    my $dom = $self->SUPER::end_document(@_);
+    # parse stylesheet 
+    my $xslt = XML::LibXSLT->new;
+    my $stylesheet = $xslt->parse_stylesheet($self->{StylesheetDOM});
+    # transform
+    my $results = $stylesheet->transform($dom);
+    # serialize to Handler and co.
+    my $parser = XML::LibXML::SAX::Parser->new(%$self);
+    $parser->generate($results);
+}
+
+sub set_handler {
+    my $self = shift;
+    $self->{Handler} = shift;
+    $self->{Parser}->set_handler( $self->{Handler} )
+        if $self->{Parser};
+}
+
+1;
+__END__
+
+=head1 NAME
+
+XML::Filter::XSLT::LibXSLT - LibXSLT SAX Filter
+
+=head1 SYNOPSIS
+
+None - use via XML::Filter::XSLT please.
+
+=head1 DESCRIPTION
+
+See above. This is a black box!
+
+=cut

Added: branches/upstream/libxml-filter-xslt-perl/current/t/00basic.t
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-filter-xslt-perl/current/t/00basic.t?rev=21541&op=file
==============================================================================
--- branches/upstream/libxml-filter-xslt-perl/current/t/00basic.t (added)
+++ branches/upstream/libxml-filter-xslt-perl/current/t/00basic.t Sun Jun 15 15:57:17 2008
@@ -1,0 +1,6 @@
+use Test;
+BEGIN { plan tests => 1 }
+END { ok($loaded) }
+use XML::Filter::XSLT;
+$loaded++;
+

Added: branches/upstream/libxml-filter-xslt-perl/current/t/01filter.t
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-filter-xslt-perl/current/t/01filter.t?rev=21541&op=file
==============================================================================
--- branches/upstream/libxml-filter-xslt-perl/current/t/01filter.t (added)
+++ branches/upstream/libxml-filter-xslt-perl/current/t/01filter.t Sun Jun 15 15:57:17 2008
@@ -1,0 +1,33 @@
+use Test;
+BEGIN { plan tests => 4 }
+use XML::Filter::XSLT;
+use XML::SAX::ParserFactory;
+use XML::SAX::Writer;
+
+my $xslt = <<EOT;
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="/">
+<new>New!</new>
+</xsl:template>
+
+</xsl:stylesheet>
+EOT
+
+my $output;
+my $w = XML::SAX::Writer->new(Output => \$output);
+my $f = XML::Filter::XSLT->new(Handler => $w, Source => {String => $xslt});
+my $p = XML::SAX::ParserFactory->parser(Handler => $f);
+
+ok($w);
+ok($f);
+ok($p);
+
+$p->parse_string(<<EOT);
+<foo/>
+EOT
+
+print "OUTPUT: $output\n";
+
+ok($output);




More information about the Pkg-perl-cvs-commits mailing list