OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Alternate color of table rows.


Hi Anmol,
In the xsl:number element, change d:tgroup to d:tbody, and add a new clause to the xsl:choose before the 'striped' test:

<xsl:choose>
  ...
  <xsl:when test="ancestor::d:thead">
    <!-- do nothing in thead -->
  </xsl:when>
  ...

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

On 3/31/2014 11:08 AM, anmol gupta wrote:
Hi,

i used following syntax as follows:

<xsl:template name="table.row.properties">

   <xsl:variable name="tabstyle">
     <xsl:call-template name="tabstyle"/>
   </xsl:variable>

     <xsl:variable name="bgcolor">
         <xsl:call-template name="dbfo-attribute">
             <xsl:with-param name="pis"
select="processing-instruction('dbfo')"/>
             <xsl:with-param name="attribute" select="'bgcolor'"/>
         </xsl:call-template>
     </xsl:variable>

     <xsl:variable name="rownum">
         <xsl:number from="d:tgroup" count="d:row"/>
     </xsl:variable>

     <xsl:choose>
         <xsl:when test="$bgcolor != ''">
             <xsl:attribute name="background-color">
                 <xsl:value-of select="$bgcolor"/>
             </xsl:attribute>
         </xsl:when>

         <!--xsl:when test="$tabstyle = 'striped'"-->
         <xsl:when test="$rownum mod 2 != 0">
             <xsl:attribute name="background-color">#EEEEEE</xsl:attribute>
         </xsl:when>
         </xsl:when>
         <!--/xsl:when-->
     </xsl:choose>
</xsl:template>


The problem that i am facing is that the *above code is setting the
background color of the entry of the thead also* which i don't want*. *

I think $rownum mod 2 != 0 is treating row 1 of thead also and coloring it.
How can i prevent this?

Thanks and Regards,
Anmol



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]