Re: empty cells in a row in a table - how can I hide them

Here is a copy of the XML data.  
The code below shows two rows of data, and three blank rows.
If it is possible, I do not want to show the rows with empty elements.

Below is the data for the XML file and further down is the .xsl code.

Thank you,
jlr

XML File shown below:

- <row>
  <column1>1</column1> 
  <column2>1</column2> 
  <column3>ea</column3> 
  <column4>VFD for trolley panel so we can have a two speed control for
north and south travel.</column4> 
  <column5>2/23/2007</column5> 
  <column6>950</column6> 
  <column7>950</column7> 
  <column8>Unknown</column8> 
  </row>
- <row>
  <column1>2</column1> 
  <column2>2</column2> 
  <column3>ea</column3> 
  <column4>VFD for trolley panel so we can have a two speed control for up
and down travel.</column4> 
  <column5>2/23/2007</column5> 
  <column6>1650</column6> 
  <column7>3300</column7> 
  <column8>Unknown</column8> 
  </row>
- <row>
  <column1 /> 
  <column2 /> 
  <column3 /> 
  <column4 /> 
  <column5 /> 
  <column6>0.0</column6> 
  <column7>0.0</column7> 
  <column8 /> 
  </row>
- <row>
  <column1 /> 
  <column2 /> 
  <column3 /> 
  <column4 /> 
  <column5 /> 
  <column6>0.0</column6> 
  <column7>0.0</column7> 
  <column8 /> 
  </row>
  <TotalTitle>Total:</TotalTitle> 
  <FinalTotal>4250.0</FinalTotal> 
 
CODE for .xsl file:     
<!--Item listing for detail rows of Detail table-->

        <fo:block  text-align="left">
          <fo:table table-layout="fixed" >                                           
          <fo:table-column column-width="15mm"/>
          <fo:table-column column-width="20mm"/>
          <fo:table-column column-width="14mm"/>
          <fo:table-column column-width="50mm"/>
          <fo:table-column column-width="18mm"/>
          <fo:table-column column-width="20mm"/>
          <fo:table-column column-width="24mm"/>
          <fo:table-column column-width="14mm"/>
           
          <fo:table-body> 
              <xsl:for-each select="header/row">        
                  <fo:table-row border-after-style="double" >                   
                     <fo:table-cell  xsl:use-attribute-sets="cell-padding" 
border="solid black 0.5px" >                       
                       <fo:block xsl:use-attribute-sets="detailtablecenter">                                  
                            <xsl:value-of select="column1"/>
                       </fo:block>      
                    </fo:table-cell>
                    <fo:table-cell  xsl:use-attribute-sets="cell-padding" 
border="solid black 0.5px" >        
                       <fo:block xsl:use-attribute-sets="detailtablecenter">           
                         <xsl:value-of select="column2"/>
                       </fo:block>                
                    </fo:table-cell>
                    <fo:table-cell xsl:use-attribute-sets="cell-padding"
border="solid black 0.5px" >                                         
                       <fo:block xsl:use-attribute-sets="detailtablecenter">         
                         <xsl:value-of select="column3"/>
                        </fo:block>  
                    </fo:table-cell> 
                    <fo:table-cell xsl:use-attribute-sets="cell-padding"
border="solid black 0.5px" >   
                        <fo:block xsl:use-attribute-sets="detailtableleft">         
                           <xsl:value-of select="column4"/>
                         </fo:block>                                   
                   </fo:table-cell>       
                   <fo:table-cell xsl:use-attribute-sets="cell-padding"
border="solid black 0.5px" >                                                        
                        <fo:block
xsl:use-attribute-sets="detailtablecenter">         
                            <xsl:value-of select="column5"/>
                        </fo:block>   
                   </fo:table-cell>
                   <fo:table-cell xsl:use-attribute-sets="numeric-cell"
border="solid black 0.5px" >   
                       <xsl:variable name="q">
                            <xsl:value-of select="column6"/>
                      </xsl:variable>
                        <fo:block xsl:use-attribute-sets="detailtableright">                            
                                <xsl:value-of
select="format-number($q,'$###,###,###.####')"/>                         
                     </fo:block>                                   
                 </fo:table-cell>                 
                 <fo:table-cell  xsl:use-attribute-sets="numeric-cell" 
border="solid black 0.5px" >       
                    <xsl:variable name="q">
                            <xsl:value-of select="column7"/>    
                    </xsl:variable>                                               
                     <fo:block xsl:use-attribute-sets="detailtableright">   
                           <xsl:value-of
select="format-number($q,'$###,###,###.##')"/>                                             
                     </fo:block>   
                 </fo:table-cell>
                 <fo:table-cell xsl:use-attribute-sets="cell-padding"
border="solid black 0.5px" >   
                     <fo:block xsl:use-attribute-sets="detailtablecenter">    
                          <xsl:value-of select="column8"/>                      
                     </fo:block>                                   
                </fo:table-cell>                           
             </fo:table-row>     
 <!--End of Item listing for detail rows of Detail table-->

            </xsl:for-each>
          </fo:table-body>
        </fo:table>
     </fo:block>         


Tony Graham-3 wrote:
> 
> 
> On Thu, May 01 2008 23:16:42 +0100, jean.stachler@crown.com wrote:
>> I have a table that may have empty cells in a row, how can I hide them?  
>> Below is an example of my code.  I have stripped out all attributes
>> thinking
>> that maybe something is causing the rows not to hide.  
>> I am very new at this stuff, so any comments is much appreciated.
> 
> xsl:if is likely all that you need, but it would help if you could
> provide a sample of your input XML, both for a row that has data and for
> one that does not, so we can better work out how to help you.
> 
> Regards,
> 
> 
> Tony Graham                         Tony.Graham@MenteithConsulting.com
> Director                                  W3C XSL FO SG Invited Expert
> Menteith Consulting Ltd
> XML, XSL and XSLT consulting, programming and training
> Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
> Registered in Ireland - No. 428599   http://www.menteithconsulting.com
>   --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
> xmlroff XSL Formatter                               http://xmlroff.org
> xslide Emacs mode                  http://www.menteith.com/wiki/xslide
> Unicode: A Primer                               urn:isbn:0-7645-4625-2
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/empty-cells-in-a-row-in-a-table---how-can-I-hide-them-tp16995095p17052360.html
Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.

Received on Sunday, 4 May 2008 23:03:40 UTC