<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

use CGI qw(:all) ;
use XML::DT ;

my $filename = shift;

%h=( -html =&gt; 1,
     -outputenc =&gt; 'ISO-8859-1',
     -type =&gt; { table =&gt; "SEQH",
                tbody =&gt; "SEQH",
                tr    =&gt; "SEQH",
              },
     td  =&gt; sub{$c},
     tr  =&gt; sub{$c},
     table  =&gt; sub{ 
        my ($li,$co)=dimTabela();
        print STDERR "Debug,$li,$co\n";
        if($li == 1 &amp;&amp; $co == 1){h1($c-&gt;[0]{-c}[0]{-c}) }
        elsif($co == 1)         {ul(li([map {$_-&gt;{-c}[0]{-c}} @$c])) }
        elsif($li == 1)         {ol(li([map {$_-&gt;{-c}} @{$c-&gt;[0]{-c}}])) }
        else                    {toxml()}
     },
   );

print dt($filename,%h);
   
sub dimTabela{
  my $nrows = @$c;
  my $ncolumns = (sort map { scalar(@{$_-&gt;{-c}}) } @$c)[-1];
  ($nrows,$ncolumns);
}
</pre></body></html>