Colspan problem

C

ceolino

Hi everybody,
I have a problem with an xsl document. I have to generate a table from
an xml document. This table has got a variable number of columns, but
after last data row I'd like to add a "Total row", which colspan should
be the number of columns less one:

-----------------------------------------------
| A | 1 | 2 | ....................|
-----------------------------------------------
| B | 1 | 2 |.....................|
-----------------------------------------------
|.............................................|
-----------------------------------------------
| Total | 3 |
-----------------------------------------------

I tried to put the colspan value into a variable..but then I obviously
can't retrieve it and put it into colspan td's attribute.
Can someone help me please?

Thanks in advance!!

Davide
 
A

Andy Dingley

generate a table from
an xml document. This table has got a variable number of columns, but
after last data row I'd like to add a "Total row", which colspan should
be the number of columns less one:

Find some XPath expression that identifies the set of columns.
Use count() to count this
Use count()-1 to find the value you need. Maybe store this in a
variable,
Place this value into the <td colspan="..." > attribute by using either

the <td colspan="{$my-colspan-count}" > syntax with a variable,
or by using
<td><xsl:attribute name="colspan" ><xsl:value-of
select="count($my-columns) -1" /></xsl:attribute>
[...]
</td>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top