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

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

by Alexandre Moraes :: Rate this Message:

Reply to Author | View in Thread

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,       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: <fo:block font-size=<?XML:NAMESPACE PREFIX = FO />"20pt"> Some Heading  </fo:block> <fo:block font-size="13pt"> Some content...  </fo:block> <fo:block font-size="20pt"> More Heading  </fo:block> <fo:block font-size="13pt"> More content...  </fo:block> But this is difficult to maintain (e.g if I change
 my mind and want all headings to be 25pt).   Is there a better way ? Does FO support something like the 'Class' notion of CSS , so that you declare that 'MyHeading' means 'font size of 20', and from now on use it, something like:    <fo:block class='MyHeading'>       Thanks very much !
      Ready for the edge of your seat?
Check out tonight's top picks  on Yahoo! TV.

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