W3C home > Mailing lists > Public > www-xsl-fo@w3.org > May 2008

How can I not include empty elements?

From: jlr <jean.stachler@crown.com>
Date: Wed, 14 May 2008 05:50:02 -0700 (PDT)
Message-ID: <17230286.post@talk.nabble.com>
To: www-xsl-fo@w3.org


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>         
-- 
View this message in context: http://www.nabble.com/How-can-I-not-include-empty-elements--tp17230286p17230286.html
Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.
Received on Wednesday, 14 May 2008 12:50:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 14 May 2008 12:50:40 GMT