title: How to achieve nested conditional rendering without empty span tags from apex:outputPanel?
body: <p>I am trying to generate clean XSL-FO from a VisualForce page. But the xml coming out of the VisualForce page is not valid due to the empty span tags that are being generated by nested apex:outputPanel tags (outer rendered=true, inner rendered=false). Here is a focused page that illustrates the problem:</p>
  
  <pre><code>&lt;apex:page contentType="text/xml" cache="false" showHeader="false" sidebar="false"&gt;
      &lt;root&gt;
          There is no reason for a nested apex:outputpanel to generate a span tag like this:  
  
          &lt;apex:outputPanel layout="none" rendered="true"&gt;
              &lt;apex:outputPanel layout="none" rendered="false" /&gt;
          &lt;/apex:outputPanel&gt;
  
          This breaks strict xml documents like XSL-FO.
      &lt;/root&gt;        
  &lt;/apex:page&gt;
  </code></pre>
  
  <p>That page gives this xml output:</p>
  
  <pre><code>&lt;root&gt;
      There is no reason for a nested apex:outputpanel to generate a span tag like this:
  
      &lt;span id="j_id0:j_id3" style="display: none;"&gt;&lt;/span&gt;
  
      This breaks strict xml documents like XSL-FO.
  &lt;/root&gt;
  </code></pre>
  
  <p>Actually, I did find an obscure reason in the <a href="http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_outputPanel.htm" rel="noreferrer">docs</a>: </p>
  
  <blockquote>
    <p>apex:outputPanel layout attribute - The layout style for the panel. Possible values include "block" (which generates an HTML div tag), "inline" (which generates an HTML span tag), and "none" (which does not generate an HTML tag). If not specified, this value defaults to "none". However, if layout is set to "none", <strong>for each child element with the rendered attribute set to "false", the outputPanel generates a span tag</strong>, with the ID of each child, and a style attribute set to "display:none". Thus, while the content is not visible, JavaScript can still access the elements through the DOM ID.</p>
  </blockquote>
  
  <p>Sounds useful if my content type is html or javascript, but it's breaking my strict xml. So the question is: how can I achieve nested conditional rendering while avoiding the span tags?</p>