W3C home > Mailing lists > Public > www-xsl-fo@w3.org > July 2007

Re: [xsl-fo] : Does FO support reusable style definition, similar to CSS?

From: axdmoraes <alexmoraes@gmail.com>
Date: Fri, 6 Jul 2007 03:33:41 -0700 (PDT)
Message-ID: <11461979.post@talk.nabble.com>
To: www-xsl-fo@w3.org

HI, I found in another site an answer for this.

You can use attribut sets like this.

Here's a direct quote from http://www.w3.org/TR/xslt.html#attribute-sets
>
> The following example creates a named attribute set title-style and uses
it
> in a template rule.
>
> <xsl:template match="chapter/heading">
>   <fo:block quadding="start" xsl:use-attribute-sets="title-style">
>     <xsl:apply-templates/>
>   </fo:block>
> </xsl:template>
>
> <xsl:attribute-set name="title-style">
>   <xsl:attribute name="font-size">12pt</xsl:attribute>
>   <xsl:attribute name="font-weight">bold</xsl:attribute>
> </xsl:attribute-set>
>

Alexandre



solmyr72 wrote:
> 
> Hi,   &nbsp;   Newbie question, please:   Does FO support 'reusable
> formatting' definitions, similar to CSS "Class" ? For example, suppose I
> have a document with 2 types of text: - Heading, using font size 20pt -
> Content, using font size 13pt So , a naiive approach produces this page:
> &lt;fo:block font-size=<?XML:NAMESPACE PREFIX = FO />"20pt"&gt; Some
> Heading&nbsp; &lt;/fo:block&gt; &lt;fo:block font-size="13pt"&gt;
> Some&nbsp;content...&nbsp; &lt;/fo:block&gt; &lt;fo:block
> font-size="20pt"&gt; More&nbsp;Heading&nbsp; &lt;/fo:block&gt;
> &lt;fo:block font-size="13pt"&gt;&nbsp;More content...&nbsp;
> &lt;/fo:block&gt; But this is difficult to maintain&nbsp;(e.g if I change
>  my mind and want&nbsp;all headings to be 25pt).   Is there a better way ?
> Does FO support something like the 'Class' notion of CSS , so
> that&nbsp;you&nbsp;declare that&nbsp;'MyHeading' means 'font size of 20',
> and&nbsp;from now on use it, something like:   &nbsp;&lt;fo:block
> class='MyHeading'&gt;   &nbsp;   Thanks very much ! &#32;
>       Ready for the edge of your seat? 
> Check out tonight's top picks  on Yahoo! TV. 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-xsl-fo--%3A-Does-FO-support-reusable-style-definition%2C-similar-to-CSS--tf4026986.html#a11461979
Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.
Received on Friday, 6 July 2007 17:10:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:14 GMT