I am trying to create a clean XSL-FO from a VisualForce page. But the xml exiting the VisualForce page is invalid due to empty span tags that are generated by the nested vertex: outputPanel tags (external rendered = true, internal rendered = false). Here is a focused page that illustrates the problem:
<apex:page contentType="text/xml" cache="false" showHeader="false" sidebar="false"> <root> There is no reason for a nested apex:outputpanel to generate a span tag like this: <apex:outputPanel layout="none" rendered="true"> <apex:outputPanel layout="none" rendered="false" /> </apex:outputPanel> This breaks strict xml documents like XSL-FO. </root> </apex:page>
This page gives this xml output:
<root> There is no reason for a nested apex:outputpanel to generate a span tag like this: <span id="j_id0:j_id3" style="display: none;"></span> This breaks strict xml documents like XSL-FO. </root>
Actually, I found an obscure reason in the docs :
apex: outputPanel layout attribute - layout style for the panel. Possible values ββinclude "block" (which generates the HTML div tag), "inline" (which generates the HTML span tag) and "none" (which does not generate the HTML tag). If not specified, this default value is "none". However, if the layout is set to "none", for each child with the rendered attribute set to "false", the outputPanel generates a span tag , with the identifier of each child and the style attribute set to "display: none". Thus, while the content is not displayed, JavaScript can still access elements through a DOM identifier.
It sounds useful if my content type is html or javascript, but it breaks my strict xml. So the question is: how can I achieve nested conditional rendering while avoiding span tags?
source share