You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Sebastian Rahtz <se...@computing-services.oxford.ac.uk> on 2000/06/30 10:02:34 UTC

hmtl2pdf.xsl

interesting, thank you Peter. 

a couple of comments after a quick glance:

 a) you write

 <xsl:template match="div">      
    <xsl:if test="@class">          
      <fo:block font-weight="bold"><xsl:value-of select="@class"/></fo:block>
    </xsl:if>  
    <fo:block>&#160;</fo:block>   
    <fo:block>   
      <xsl:apply-templates select="* | text()"/>
    </fo:block>                   
    <fo:block>&#160;</fo:block>     
  </xsl:template>             


why do you (here and elsewhere) put in the

    <fo:block>&#160;</fo:block>     


 b)   <fo:inline-graphic href="file:{../@href}"/>

 I cannot see why you prepend the file: here?

 c) you say (unsurprisingly) that you did not cope with CSS. It is
nice to see a practical, simple, example of why CSS is such a pain;
you cannot parse it with `normal' tools....

sebastian


Re: hmtl2pdf.xsl

Posted by Peter Murray-Rust <Pe...@nottingham.ac.uk>.
At 09:02 30/06/00 +0100, Sebastian Rahtz wrote:
>interesting, thank you Peter.
>
>a couple of comments after a quick glance:
>
>  a) you write
>
>  <xsl:template match="div">
>     <xsl:if test="@class">
>       <fo:block font-weight="bold"><xsl:value-of select="@class"/></fo:block>
>     </xsl:if>
>     <fo:block>&#160;</fo:block>
>     <fo:block>
>       <xsl:apply-templates select="* | text()"/>
>     </fo:block>
>     <fo:block>&#160;</fo:block>
>   </xsl:template>
>
>
>why do you (here and elsewhere) put in the
>
>     <fo:block>&#160;</fo:block>

Because I found (perhaps wrongly) that <fo:block></fo:block> - which is 
equivalent to <fo:block/> - doesn't seem to output a block in the PDF. This 
may be a feature of the way I use it or the version of FOP.


>  b)   <fo:inline-graphic href="file:{../@href}"/>
>
>  I cannot see w(hy you prepend the file: here?

Because I think the reading software (Xerces, I think) throws a "Protocol 
not found" exception [I'm writing from memory]. My kludge is horrible and 
needs altering so that the *.xsl only adds a protocol if it's missing

>  c) you say (unsurprisingly) that you did not cope with CSS. It is
>nice to see a practical, simple, example of why CSS is such a pain;
>you cannot parse it with `normal' tools....

Yes - we really need a CSS parser *in the stylesheet* something like:
         node-set = parseCSS("html/head/style")

Then we could take, say:

<style>p.note {font-weight: bold}</style>

and

<p class="note">Important message</p>

and translate it (using XSLT and key()) to

<fo:block font-weight="bold">Important message</fo:block>

Not trivial, but worth aiming for

         P.

>sebastian

Peter Murray-Rust, Director Virtual School of Molecular Sciences
Pharmaceutical Sciences, University of Nottingham, NG7 2RD, UK
Tel: +44-(0)-115-951-5087 Fax: +44-(0)-115-951-5110
http://www.vsms.nottingham.ac.uk