The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XML::Filter::TableWrapper - Wrap a table's cells in to a certain number of rows

SYNOPSIS

    use XML::Filter::TableWrapper;
    use XML::SAX::Machines qw( Pipeline );

    ## Ouput a table with 5 rows, the last row having 3 cells:
    Pipeline(
        XML::Filter::TableWrapper->new(
            Columns => 3,   # The default is 5
        ),
        \*STDOUT,
    )->parse_string( "<table>" . "<td/>" x 23 . "</table" );

DESCRIPTION

Takes a list of elements and inserts (by default) <tr>...</tr> elements to make an table with a specified number of columns (5 by default). By default, it assumes that the container element is named "{}table" (the "{}" means it is not namespaced), but this can be changed:

    XML::Filter::TableWrapper->new(
        ListTags => "{$my_ns}rows",
        Columns  => 3,
    );

for instance.

LIMITATIONS

These can be read as possible future features:

  • Be able to translate the container tag to some other, for instance:

        ListTags => {
            "{}ul" => {
                TableTag  => "{}table",
                RowTag    => "{}tr",
                CellTag   => "{}td",
            },
        }
  • Autoadapt if the user specifies empty "{}" namespaces and the events have no NamespaceURI defined, and vice versa.

  • Row filling instead of column filling.

  • Stripping of existing row tags, for "refilling" a table.

  • Callbacks to allow the various tags to be built, so they can have attributes. This would be a decent way of allowing greybar, for instance.

Columns
    $h->Columns( 1024 );
    my $columns = $h->Columns;

Set/get the number of columns to wrap to.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 97:

'=item' outside of any '=over'

=over without closing =back