Subject:thought I was being clever but I'm not Author:Jerry Janofsky Date:14 Oct 2007 02:36 PM
In my XSLT below, I am using the CDATA section because if I don't then the this XSLT is not a valid XML document (this is where I thought I was being clever). Stylus studio will throw an error because the XML format is improper; <fo:table-row> is not followed by </fo:table-row> before the </xsl:if>. By using the CDATA section, the XSLT becomes valid XML and the XSL:FO document that is generated will also be valid. I am disabling output escaping because if I don't, the '<' and '>' in fo:table-row will be escaped and the RenderX XSL:FO processor won't process it properly. When I execute this with SAXON 8 in stylus studio everything is fine. However, my production environment uses SAXON 8 with something called COCOON. I end up with the following problomatic XSL:FO document section that I can't fix:
Subject:thought I was being clever but I'm not Author:Tony Lavinio Date:15 Oct 2007 12:12 AM
First, never use disable-output-escaping. It only works properly
when each stage in the serialization understands it, and many
environments such as Cocoon don't, because they do different things
with the data so that at each step they need 'real' XML.
The proper way to handle situations like this is to ALWAYS remember
that XML is not composed of content with tags interspersed, but instead
is composed of elements that contain content. So you always want your
<> and </> to be balanced.
Another method might be to process three rows at a time, and
just using <xsl:if>'s to wrap the 2nd and 3rd to make sure you
don't run off the end of the list.