Recently I was asked to make some simple adjustments to the docbook .xps
files to accommodate our docbook documents. Specifically the way that
it handles tables and column spans. When we changed our docbook markup
we followed the docbook std as close as we could as shown in the
following example:
<informaltable border="1">
<tgroup cols="5">
<colspec colname="c1"/>
<colspec colname="c1"/>
<colspec colname="c1"/>
<colspec colname="c1"/>
<colspec colname="c1"/>
<spanspec spanname="hspan" namest="c2" nameend="c5" />
<row>
<entry> </entry>
<entry spanname="hspan">Never Occured</entry>
</row>
<row>
<entry>a. ridiculas or teasing</entry>
<entry>1</entry>
<entry>2</entry>
<entry>3</entry>
<entry>4</entry>
</row>
</tgroup>
</informaltable>
Now based on that I hacked a quick and what I thought successful
solution to this with the following .xps additional code:
my @cnames; my %snames;
$t->{'colspec'}{testcode} = sub {
my ($node, $t) = @_;
push @cnames, findvalue('@colname', $node);
};
$t->{'spanspec'}{testcode} = sub {
my ($node, $t) = @_;
my $sname = findvalue('@spanname', $node);
%snames = ($sname =>
[ findvalue('@namest', $node)
, findvalue('@nameend', $node) ]);
};
$t->{'entry'}{testcode} = sub {
my ($node, $t) = @_;
$t->{pre} = '<td';
[[ snip ]]
# other attribute code here
[[ snip ]]
if (findvalue('@spanname', $node)) {
for my $spec (keys %snames) {
my $colspancnt = 0;
for my $cname (@cnames) {
$colspancnt++ if ($snames{$spec}[0]
eq $cname);
if ($snames{$spec}[1] eq $cname) {
if ($snames{$spec}[1] eq $cname) {
$t->{pre} .= ' colspan="';
$t->{pre} .= ++$colspancnt.'"';
}
}
}
}
$t->{pre} .= '>';
$t->{post} = '</td>';
return 1;
};
Of course now the global vars @cname and %snames are empty and I thought
at one time this was working but maybe that was a dream or my ramped
imagination. Anyway, I was wondering what might be the cause of this
because I know we have used global vars before in .xps pages, so I am
unsure of where to even begin to look.
Thanks,
Jason Kumpf
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]