Passthrough text results in HTML files with no line breaks in source
If you apply a "passthrough" condition to a block of text in your document, then ePublisher has a tendency to change the way the rest of the HTML document from that point on. It may not affect the appearance of your output in a browser, but it can become difficult to achieve certain passthrough functions or to debug the resulting HTML code. For example, one user wanted to add a flash movie by using the following passthrough syntax in their source document:
// <![CDATA[ var args = new Object(); var query = location.search.substring(1); var pairs = query.split( "," ); for ( var i = 0; i < pairs.length; i++ ) { var pos = pairs[i].indexOf('='); if( pos == -1 ) { continue; } var argname = pairs[i].substring( 0, pos ); var value = pairs[i].substring( pos + 1 ); args[argname] = unescape( value ); } // ]]>
The data was entered as separate paragraphs in the document, and a passthrough condition was applied. The expectation is that the output will contain text that appears exactly as it was entered so that the code can be processed correctly by the browser. Unfortunately, the resulting HTML file contained the following paragraph:
// <![CDATA[ var args = new Object(); var query = location.search.substring(1); var pairs = query.split( "," ); for ( var i = 0; i < pairs.length; i++ ) {var pos = pairs[i].indexOf('='); if( pos == -1 ) { continue; } var argname = pairs[i].substring( 0, pos ); var value = pairs[i].substring( pos + 1 ); args[argname] = unescape( value ); } // ]]>
The browser understands the entire line as a single comment, and thus the attempt to insert a file failes because the code is not valid. Additionally, the rest of the HTML document lacks line breaks between paragraphs and tags, making it tough to view the HTML source and make any sense of it.
This results from a known defect, #WWEP2328. Any use of the <xsl:text> or <wwxsldoc:text> extensions in the XSL seems to have this effect, unless the inserted text is wrapped in some other element, such as <xsl:comment> or another tag (e.g., <html:null>).
UPDATE (06/16/09)
If you need to add line breaks to separate your passthrough text from the rest of the HTML content, there may be an option on that front as well. It requires an override to a file called content.xsl. The file is already included in your project (Formats/Dynamic HTML/Transforms/), so just open that file in a text- or XML-editing application.
Locate this line:
<xsl:template name="Paragraph-PassThrough">
Before the first <wwexsldoc> line and after the closing line, add this:
<xsl:text>
</xsl:text>
So, the complete template should read:
<xsl:template name="Paragraph-PassThrough"> <xsl:param name="ParamParagraph" /> <xsl:text>
</xsl:text> <wwexsldoc:Text disable-output-escaping="yes"> <xsl:for-each select="$ParamParagraph/wwdoc:TextRun/wwdoc:Text"> <xsl:variable name="VarText" select="." /> <xsl:value-of select="$VarText/@value" /> </xsl:for-each> </wwexsldoc:Text> <xsl:text>
</xsl:text> </xsl:template>
Save and close content.xsl and regenerate your output to apply the changes. That will have the effect of ensuring each passthrough paragraph is separated from other content by a line break in the HTML file. The rest of the HTML content will still be strung together, but that shouldn't affect the way it is displayed in a user's browser.