forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <rgard...@apache.org>
Subject Re: comment-lines from html to xml to fo...
Date Tue, 13 Mar 2007 21:30:39 GMT
Thomas Emmel wrote:
> Hi,
> 
> Can someone explain to me why I always get these '<!-- -->' strings 
> times the number of meta-info in my original html-document???
> 
> I think this was asked before but I cannot find any point to start in 
> the mailing-lists.
> 
> I start with a normal html-document which contains for several reasons 
> some meta-information in its head like this
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html>
> <head>
> <title>Some title...</title>
> <meta content="TE" name="author">
> <meta content="2.4.1" name="chapter">
> <link rel="stylesheet" href="../my.css" type="text/css">
> </head>
> <body>
> ....
> 
> I cannot remove these meta-lines since they are needed to pass extra 
> info to forrest...
> .xml from html-to-document.xsl will look like this:
> 
> <document>
> <header>
> <title>Some title...</title>
> <!-- <meta name="author" content="TE"/> -->
> <!-- <meta name="chapter" content="2.4.1"/> -->
> <link type="text/css" href="../my.css" rel="stylesheet"/>
> </header>
> <body>
> ...
> 
> now .fo and hence .pdf will have this content:
> 
> <fo:flow flow-name="xsl-region-body">
> <fo:block id="N101B3" font-weight="bold" font-size="24pt" 
> padding-after="24pt" padding-before="24pt">Some title...</fo:block>
> <fo:block padding-after="18pt" padding-before="18pt" text-align="left">
>  <!--  -->  <!--  -->
> <fo:basic-link external-destination="../my.css" 
> text-decoration="underline" color="#0F3660"/>
> <fo:block width="7.5in" text-align="justify" space-before="5pt" 
> space-after="5pt" font-weight="bold" font-size="14pt" 
> font-family="serif">Table of contents</fo:block>
> ...
> 
> 
> However "<!-- -->" is realy visible in the pdf and that is annoying.
> How can I avoid that and force fo to strip those comment-sign.
> 
> I use 0.8dev, slightly modified with an own skin and xsl-files.
> 
> Thanks very much in advance

You appear to have uncovered a bug.

I'm not sure why the meta tags are left in the xdoc format. Perhaps a 
debugging remnant. I suspect it would be safe to remove the relevant XSL 
that produces these comments.

However, as you correctly surmise this is not the actual cause. The real 
problem lies in the *.fo generation from document-to-fo.xsl (in the 
common skin since the one in pelt just imports the common one).

In here the offending template is:

       <fo:block
         text-align="{$text-align}"
         padding-before="18pt"
         padding-after="18pt">
         <xsl:apply-templates/>
       </fo:block>

Just why it is causing the comment blocks to appear with no content I 
cannot explain.

My suggestion would be to add a template to strip the comments out. 
After all, *.fo and *.pdf are not meant as human readable formats, so 
why bother with comments.

Try adding the following template to the end of document-to-fo.xsl:

<xsl:template match="comment()"/>

Please be sure to let us know if it works, I'll run the fix past the 
devs to see if there are any side-effects I've not considered and if I 
get the OK I'll commit the change to SVN.

Ross



Mime
View raw message