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 Potje rode kool <ev...@gmail.com> on 2006/12/03 19:08:41 UTC

specify values for attribute once and then refer to it.

Hi,

Is it posible to specify on one place some values for attributes and then
refer to that, a bit like its done with css, where you create a class and
refer to it
with the class attribute in the html element?

Thanks.
Evert

Re: specify values for attribute once and then refer to it.

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Dec 3, 2006, at 19:08, Potje rode kool wrote:

Hi,

> Is it posible to specify on one place some values for attributes  
> and then
> refer to that, a bit like its done with css, where you create a  
> class and refer to it
> with the class attribute in the html element?

Google around for xsl:attribute-set / use-attribute-sets

HTH!

Cheers,

Andreas


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


Re: specify values for attribute once and then refer to it.

Posted by Jay Bryant <ja...@bryantcs.com>.
I set up all my styles as collections of attributes in attribute sets, thus:

  <xsl:attribute-set name="body">
    <xsl:attribute name="font-size">11pt</xsl:attribute>
    <xsl:attribute name="font-family">serif</xsl:attribute>
    <xsl:attribute name="line-height">15pt</xsl:attribute>
    <xsl:attribute name="space-before.optimum">3pt</xsl:attribute>
    <xsl:attribute name="space-after.optimum">3pt</xsl:attribute>
  </xsl:attribute-set>

I keep a whole collection of attribute sets in various files (one or more to a client). Then I can write 

<fo:block xsl:use-attribute-sets="body">paragraph content</fo:block>

and get all the attributes. This method GREATLY improves readability and consistency, especially since I can share the same set of styles (in their own file, remember) across multiple documents (such as all of a customer's user guides).

To link the styles document to your main XSL transform, use the xsl:include command, thus:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="fo xs">

  <xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="no"/>

  <xsl:include href="globe-report-formats.xsl"/>

  <!-- Your transforms here -->

</xsl:transform>

I hope that helps.

Jay Bryant
Bryant Communication Services
  ----- Original Message ----- 
  From: Potje rode kool 
  To: fop-users@xmlgraphics.apache.org 
  Sent: Sunday, December 03, 2006 12:08 PM
  Subject: specify values for attribute once and then refer to it.


  Hi,

  Is it posible to specify on one place some values for attributes and then
  refer to that, a bit like its done with css, where you create a class and refer to it
  with the class attribute in the html element? 

  Thanks.
  Evert