You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by Thomas Emmel <em...@abaqus.de> on 2007/03/13 14:40:43 UTC

comment-lines from html to xml to fo...

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

Thomas

Re: comment-lines from html to xml to fo...

Posted by Ross Gardler <rg...@apache.org>.
Thomas Emmel wrote:
> Ross Gardler wrote:
>> Ferdinand Soethe wrote:
>>> Ross Gardler wrote:
>>>
>>>> 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.
>>>
>>> Please don't remove the meta-elements in these transformations as they
>>> are needed for transporting a number of different pieces of info about
>>> the source document from source to final html.
>>
>> These are commented out meta-element in the XDoc, they are not the 
>> actual meta-elements. Please see the above comment in context for an 
>> example.
>>
>> Are you saying that the commented meta-elements are used anywhere? I 
>> am not aware of such a thing, and if they are used I do not understand 
>> why they are commented out.
>>
>> Ross
> 
> I use this meta-elements for additional chapter-counters, so that I have 
> in my html-pages e.g. 2.5.x.x.x... and in the pdf too.
> Therefore I add
> <meta content="2.5" name="chapter">
> to my .html
> In site-to-xhtml.xsl I process this information e.g. for every section.
> I know that is a dirty hack and it produces e.g. this
> <h1>
> <meta>
> <meta>
> <meta>
> <meta>
> <meta>
> <meta>2.5.1. </meta>a new section ...</h1>
> 
> Which looks realy ugly :-( in code but the result in the browser is 
> looking good and that counts for our projects...
> 
> However this meta is not valid vor the DTD and hence - I think - it is 
> commented out. Although it gets processed (bug?).
> 
> Give me a better work-around than using meta and I will be happy (And 
> give me the time to implement that :-)))

Meta-Data support in Forrest is sketchy, at best. There is some support, 
and quite a few discussions about the best way to improve that support. 
I'd suggest starting with a mail archive search, particularly in the dev 
lists. For starters you may like to look at [1], [2] (same thread, so 
you should really read the whole thing really).

If this thread or your current thinking leads you to think that you can 
help us create a better and/or more complete solution please join us 
over on the dev list.

Ross

[1] http://marc.theaimsgroup.com/?l=forrest-dev&m=110324061019177&w=2
[2] http://marc.theaimsgroup.com/?l=forrest-dev&m=110357528502172&w=2

Re: comment-lines from html to xml to fo...

Posted by Thomas Emmel <em...@abaqus.de>.
Ross Gardler wrote:
> Ferdinand Soethe wrote:
>> Ross Gardler wrote:
>>
>>> 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.
>>
>> Please don't remove the meta-elements in these transformations as they
>> are needed for transporting a number of different pieces of info about
>> the source document from source to final html.
> 
> These are commented out meta-element in the XDoc, they are not the 
> actual meta-elements. Please see the above comment in context for an 
> example.
> 
> Are you saying that the commented meta-elements are used anywhere? I am 
> not aware of such a thing, and if they are used I do not understand why 
> they are commented out.
> 
> Ross

I use this meta-elements for additional chapter-counters, so that I have 
in my html-pages e.g. 2.5.x.x.x... and in the pdf too.
Therefore I add
<meta content="2.5" name="chapter">
to my .html
In site-to-xhtml.xsl I process this information e.g. for every section.
I know that is a dirty hack and it produces e.g. this
<h1>
<meta>
<meta>
<meta>
<meta>
<meta>
<meta>2.5.1. </meta>a new section ...</h1>

Which looks realy ugly :-( in code but the result in the browser is 
looking good and that counts for our projects...

However this meta is not valid vor the DTD and hence - I think - it is 
commented out. Although it gets processed (bug?).

Give me a better work-around than using meta and I will be happy (And 
give me the time to implement that :-)))

Thomas

Re: comment-lines from html to xml to fo...

Posted by Ferdinand Soethe <ma...@soethe.net>.
Ross Gardler wrote:

> These are commented out meta-element in the XDoc, they are not the
> actual meta-elements. Please see the above comment in context for an
> example.

Hmmm. Might have misunderstood the discussion but I read

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

to mean that he has normal meta elements in html which will(should)
become meta elements in xdoc and will turn into empty comments somewhere
down the pipeline.

> Are you saying that the commented meta-elements are used anywhere? I am
> not aware of such a thing, and if they are used I do not understand why
> they are commented out.

No, no problem with things commented out.
If that was a misunderstanding please ignore my comments.


Regards,
Ferdinand Soethe

Re: comment-lines from html to xml to fo...

Posted by Ross Gardler <rg...@apache.org>.
Ferdinand Soethe wrote:
> Ross Gardler wrote:
> 
>> 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.
> 
> Please don't remove the meta-elements in these transformations as they
> are needed for transporting a number of different pieces of info about
> the source document from source to final html.

These are commented out meta-element in the XDoc, they are not the 
actual meta-elements. Please see the above comment in context for an 
example.

Are you saying that the commented meta-elements are used anywhere? I am 
not aware of such a thing, and if they are used I do not understand why 
they are commented out.

Ross

Re: comment-lines from html to xml to fo...

Posted by Ferdinand Soethe <ma...@soethe.net>.
Ross Gardler wrote:

> 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.

Please don't remove the meta-elements in these transformations as they
are needed for transporting a number of different pieces of info about
the source document from source to final html.

Ferdinand

Re: comment-lines from html to xml to fo...

Posted by Thomas Emmel <em...@abaqus.de>.
Ross,

Thanks for the answer but unfortunately it doesn't work :-(
The signs are still there.
And yes I bother with comments since I see them in acroread, I did not 
mean the pdf-file as source...

Any other idea?

Thomas

Ross Gardler wrote:
> 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
> 
> 


Re: comment-lines from html to xml to fo...

Posted by Ross Gardler <rg...@apache.org>.
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