Re: [xslt] improvement for xsltproc --timing



Am 08.01.2010 20:58, schrieb Liam R E Quin:
> 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$_";
> }
> 

Thanks Liam, thats a neat hack and enough for my purpose too!

Stefan


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