Author: sjur Date: Fri Jan 19 08:58:30 2007 New Revision: 497876 URL: http://svn.apache.org/viewvc?view=rev&rev=497876 Log: Corrected an error from revision 462418 to allow content before the first header in an HTML document. The previous solution caused all content be duplicated if there was no h1 element as daughter of the body element.
This commit fixes the issue by moving the pre-h1 processing within the conditional, and thus dependent on the existence of such. The change is tested locally, fixes the duplication issue, and should not cause other side effects. Modified: forrest/trunk/main/webapp/resources/stylesheets/html-to-document.xsl Modified: forrest/trunk/main/webapp/resources/stylesheets/html-to-document.xsl URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/resources/stylesheets/html-to-document.xsl?view=diff&rev=497876&r1=497875&r2=497876 ============================================================================== --- forrest/trunk/main/webapp/resources/stylesheets/html-to-document.xsl (original) +++ forrest/trunk/main/webapp/resources/stylesheets/html-to-document.xsl Fri Jan 19 08:58:30 2007 @@ -66,10 +66,12 @@ <!--infer structure from sibling headings--> <xsl:template match="body"> <body> - <!-- some paragraphs may be included before the first title... --> - <xsl:apply-templates select="*[1]" mode="next"/> <xsl:choose> <xsl:when test="h1"> + <!-- some paragraphs may be included before the first title... --> + <xsl:if test="name(*[1]) != 'h1'"> + <xsl:apply-templates select="*[1]" mode="next"/> + </xsl:if> <xsl:call-template name="process_h1"/> </xsl:when> <xsl:otherwise> @@ -311,8 +313,6 @@ <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> - - <xsl:apply-templates select="./*"/> </xsl:template> <xsl:template match="@*|*|text()|processing-instruction()|comment()">