You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by sj...@apache.org on 2007/01/19 17:58:31 UTC

svn commit: r497876 - /forrest/trunk/main/webapp/resources/stylesheets/html-to-document.xsl

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()">



Re: svn commit: r497876 - /forrest/trunk/main/webapp/resources/stylesheets/html-to-document.xsl

Posted by Thorsten Scherler <th...@apache.org>.
On Fri, 2007-01-19 at 23:43 +0200, Sjur Moshagen wrote:
> Den 19. jan. 2007 kl. 18.58 skrev sjur@apache.org:
> 
> > Author: sjur
> > Date: Fri Jan 19 08:58:30 2007
> > New Revision: 497876
> 
> My first commit:-)

:)

Yeah, welcome as forrest committer.

> 
> > Modified:
> >     forrest/trunk/main/webapp/resources/stylesheets/html-to- 
> > document.xsl
> 
> Please check that everything is fine, including EOL etc.
> 

no problem shown yet, but you have not added files. There is normally
the problem.

See Gavs post about it.

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)



Re: svn commit: r497876 - /forrest/trunk/main/webapp/resources/stylesheets/html-to-document.xsl

Posted by Sjur Moshagen <sj...@mac.com>.
Den 19. jan. 2007 kl. 18.58 skrev sjur@apache.org:

> Author: sjur
> Date: Fri Jan 19 08:58:30 2007
> New Revision: 497876

My first commit:-)

> Modified:
>     forrest/trunk/main/webapp/resources/stylesheets/html-to- 
> document.xsl

Please check that everything is fine, including EOL etc.

> 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()">

I forgot one of my own rules before commiting a change: always review  
the changes (ie do a diff before svn ci) - thus, I missed the last  
change I had made, and forgot to comment it. The change actually  
resolves issue 704, and possibly also the other bug described in the  
last comment in that issue.

Sjur