« Return to Thread: How can I not include empty elements?

How can I not include empty elements?

by jlr :: Rate this Message:

Reply to Author | View in Thread

I have an XML document that will display the elements as shown below.
Basically, the elements are a subset of the <row> tag.  The elements
will always have the tag names of column1, column2, column3, and column4.
As shown in the example below, some of the tag names column1, etc. may
have elements, and some of the tag names for column1, etc. may be empty
elements.  I have only given one listing of empty elements, but this could be up to
50 empty elements.  When creating the PDF document in xslt, is there a way of  removing
the empty elements so that they won't display?
I have the xslt code after the xml detail.

Thanks in advance for any comments.
jlr

XML DETAIL ***************************************************
     <row>        
           <column1>
              1
           </column1>      
           <column2>
              233
           </column2>        
           <column3>
              ea
           </column3>      
           <column4>
              this is a bigg statement within the document I am just adding some numbers and calculations
           </column4>    
       </row>
       <row>
           <column1>
               2
           </column1>      
           <column2>
               333
           </column2>        
           <column3>
               ea
           </column3>      
           <column4>
              fds fds fds fd fds fds fds fds fds fds fds fds fds fds fds fds
           </column4>    
       </row>
       <row>    
          <column1>
            3
         </column1>      
         <column2>
             6
         </column2>        
         <column3>
             ea
         </column3>      
         <column4>
            dsffsdiowkledsjknlefdsihjbwqjkb ysf uhfehufeuhfeuhfe
         </column4>            
       </row>
       <row>
          <column1>
           
         </column1>      
         <column2>
           
         </column2>        
         <column3>
           
         </column3>      
         <column4>
           
         </column4>    
       </row>  

XSLT CODE:********************************************************

  <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-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-row>                
            </xsl:for-each>
          </fo:table-body>
        </fo:table>
     </fo:block>        

 « Return to Thread: How can I not include empty elements?