Re: [xslt] improvement for xsltproc --timing



On Tue, 2010-01-05 at 10:49 +0200, Stefan Kost wrote:

> For this it would be cool if xsltproc could do some magic to apply
> timestamps to output from libxslt/xsltutils.c:xsltMessage().

In the past I've done this with an external program that
timestamped each line.  You may need to use a named pipe on
Unix-like systems so that xsltproc's output isn't buffered; one
way to do this is with "unbuffer" which is part of the "expect"
package (it's not installed by default here, with Mandriva Linux,
but is part of the expect-examples package...)

e.g.

unbuffer xsltproc the-stylesheet.xsl input.xml | add-timestamps

where add-timetamps is, e.g.

#! /usr/bin/perl -w
use strict;
use Time::HiRes qw/gettimeofday/;

binmode(STDIN, ":utf8");
binmode(STDOUT, ":utf8");

$| = 0; # unbuffered output too

while (<>) {
    my ($s, $ms) = gettimeofday();
    print "$s.$ms\t$_";
}




-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]