From: Anders S. Mortensen Date: Mon, 11 Dec 2006 13:58:17 +0000 (+0000) Subject: Only select those irspy:xxx entries newer than the status/ping date. Still need X-Git-Tag: CPAN-v1.02~54^2~632 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=d9d44e8220067d39978efcebcc2fd1664da9b701;p=irspy-moved-to-github.git Only select those irspy:xxx entries newer than the status/ping date. Still need to handle the situation where there are no newer entries so that we'll need to select the entries corresponding to previous run. --- diff --git a/lib/ZOOM/IRSpy.pm b/lib/ZOOM/IRSpy.pm index b190d62..098946a 100644 --- a/lib/ZOOM/IRSpy.pm +++ b/lib/ZOOM/IRSpy.pm @@ -1,4 +1,4 @@ -# $Id: IRSpy.pm,v 1.52 2006-12-06 11:26:52 mike Exp $ +# $Id: IRSpy.pm,v 1.53 2006-12-11 13:58:17 sondberg Exp $ package ZOOM::IRSpy; @@ -72,6 +72,10 @@ sub new { or die "$0: can't connection to IRSpy database 'dbname'"; my $xslt = new XML::LibXSLT; + + $xslt->register_function($ZOOM::IRSpy::Utils::IRSPY_NS, 'strcmp', + \&ZOOM::IRSpy::Utils::xslt_strcmp); + my $libxml = new XML::LibXML; my $xsl_doc = $libxml->parse_file($irspy_to_zeerex_xsl); my $irspy_to_zeerex_style = $xslt->parse_stylesheet($xsl_doc); @@ -241,9 +245,16 @@ sub _render_record { sub _irspy_to_zeerex { my ($this, $conn) = @_; my $irspy_doc = $conn->record()->{zeerex}->ownerDocument; + #open FH, '>/tmp/irspy_orig.xml'; + #print FH $irspy_doc->toString(); + #close FH; my %params = (); my $result = $this->{irspy_to_zeerex_style}->transform($irspy_doc, %params); + #open FH, '>/tmp/irspy_transformed.xml'; + #print FH $result->toString(); + #close FH; + return $result->documentElement(); } diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm index 6367761..371a7de 100644 --- a/lib/ZOOM/IRSpy/Utils.pm +++ b/lib/ZOOM/IRSpy/Utils.pm @@ -1,4 +1,4 @@ -# $Id: Utils.pm,v 1.19 2006-12-05 17:19:35 mike Exp $ +# $Id: Utils.pm,v 1.20 2006-12-11 13:58:17 sondberg Exp $ package ZOOM::IRSpy::Utils; @@ -285,7 +285,11 @@ sub inheritance_tree { } -#print "Loaded ZOOM::IRSpy::Utils.pm"; +# This function is made available in xslt using the register_function call +sub xslt_strcmp { + my ($arg1, $arg2) = @_; + return ($arg1->to_literal()) cmp ($arg2->to_literal()); +} 1; diff --git a/xsl/irspy2zeerex.xsl b/xsl/irspy2zeerex.xsl index 8a64677..162ae5e 100644 --- a/xsl/irspy2zeerex.xsl +++ b/xsl/irspy2zeerex.xsl @@ -1,6 +1,6 @@ - +