You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Mike Trotman <mi...@datalucid.com> on 2003/11/01 13:00:19 UTC

Re: html class attribute like

I currently use something similar to both approaches for generating 
formatting attributes.

Behind both I have a file which stores the CSS class definitions in a 
simple XML format
(with some name/value variations where FO attribute names / properties 
are different - and some XSLT documents for constructing local 
transformations)

Background:

I have documents with many different styles and context sensitive 
triggering of which styles / parts of styles to use.
For these I have a pre-processing phase (written in Perl rather than 
XSLT as the context evaluation is easier) which loads the CSS XML file,
scans the input XML and constructs and outputs attribute sets + outputs 
a new XML with extra elements pointing to the relevant attribute-set.
(There are several of these - so that I can output HTML and a valid css 
stylesheet and use CSS stylesheet classes + have local attributes.)
(This also lets me tune the process so I can eventually switch to a SAX 
stream.)

This keeps the size of the FO files 'small' - and if I need to change 
formatting I can do most of it by just generating a new attribute-sets file.
I can also load and lookup attributes in the attribute-sets file to 
extract individual attributes if I need to do local overriding of global 
classes.

The resulting XML file is then processed by XSLT to XSLFO with my 
standard templates.

For simpler documents - or documents built by combining smaller 
documents - I have a slightly more complex XSLT which also loads several 
CSS XML files
and does lookups etc. to assign local attributes for all FO nodes.
This is so I can have different 'localised' attribute sets with the same 
names for different sub-documents.
These FO files can get quite large - and any formatting changes require 
regeneration.

Conclusion:

If you are doing a straight HTML CSS class equivalence then I would 
recommend generating an attribute-sets file
and then using that in your FO output (as I find this makes tuning / 
debugging formatting much easier).
This also - as you rightly say - keeps the XSL much simpler - and in my 
case also makes the processing and less memory hungry.
I have found that trying to do all the attribute calculations in one 
XSLT phase
is harder to maintain and extend - particularly when you need further 
variations + local overriding attributes.

I am actually switching most of my complex XSLT style/class processing 
to the latter case for the above reasons.

HTH

Bruno Sanz Marino wrote:

>Ok
>
>I´will try the J.Pietschmann idea (xsl:use-attribute-sets)
>
>I think i need to do 3 transformations to do the "html-css to fo" process
>
>The first one to create the xsl:attribute-set templates form the css source
>(one for each css class rule)
>
>The second one to transform the "class" html attribute to the xsl "xsl:use-attribute-sets"
>attribute in the xhtml source file
>
>And the last one for generate the general "fo" file
>
>Another posibility (only 2 transformations) is not to use the xsl:use-attribute-sets.
>When i find the "class" attribute, I call one general template wich select
>the attributes to generate (in function of the value of the "class attribute"...this
>is to say, the classname). I could avoid the second transformation, but
>the xsl would be more complex
>
>....OPINIONS ???
>
>BRuno
>
>NUEVO TISCALI ADSL ON
>¡Navega desde las 15.00h. a alta velocidad por sólo 29,50 €/mes!
>Conócelo en http://acceso.tiscali.es/pag-acceso-adsl-on.jsp?did=adn-7520007
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: fop-user-help@xml.apache.org
>  
>

-- 
Datalucid Limited
8 Eileen Road
South Norwood
London SE25 5EJ
tel :0208-239-6810
mob: 0794-725-9760
email: mike.trotman@datalucid.com
UK Co. Reg: 	4383635
VAT Reg.: 	798 7531 60




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org