← Prev in month ← Prev in thread

Set different margins for each column of a CALS table

From
redlettucemail <>
Date
2011-10-02T20:30:30+00:00
ID
Thread
Set different margins for each column of a CALS table
X-NONE
  X-NONE
  
   
   
   
   
   
   
   
   
   
   
   
  
  
   
   
   
   
   
   
   
   
   
   
   
  

I have a table with numbers in each cell 
that vary in length
from one to seven digits (e.g. 1 to 1000000). I’d like to align all 
‘entry’
elements *in each respective column* by somehow specifying a variable in 
which
I can set different ‘margin-right’ values so that all ‘entry’ in 
each column
get that particular margin-right value. 

 

I have looked only at the 
colspec element for each column
(thinking that any values specified in that are propagated to ‘entry’ 
elements)
and seeing whether I can specify in the XML code an attribute that would 
take a
% value for margin-right – I can’t see how that’s possible. 

I’ve also tried specifying a variable in 
<xsl:template match="d:entry|d:entrytbl" name="entry">
that sets the margin-right value, but I can’t see the logic of how the 
values
could be propagated to each column or where to put the following code:

         

<xsl:variable name="numbermargin">

          

<xsl:if test="ancestor::d:colspec/@colnum=2">

            

<xsl:attribute name="margin-right">
20%
</xsl:attribute>

          

</xsl:if>

          

<xsl:if test="ancestor::d:colspec/@colnum=3">

            

<xsl:attribute name="margin-right">
25%
</xsl:attribute>

          

</xsl:if>

          

<xsl:if test="ancestor::d:colspec/@colnum=4">

            

<xsl:attribute name="margin-right">
30%
</xsl:attribute>

          

</xsl:if>

          

<xsl:if test="ancestor::d:colspec/@colnum=5">

            

<xsl:attribute name="margin-right">
15%
</xsl:attribute>

          

</xsl:if>

          

</xsl:variable>

I’m not even sure if it’s possible to match up 
entries with
a respective colnum (given my limited knowledge of XPath expressions). Is 
there
a quick solution?
 

Dave Gardiner
← Prev in month ← Prev in thread