RE: [xsl] Conditionally use attribute sets?

Subject: RE: [xsl] Conditionally use attribute sets?
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Tue, 15 Nov 2005 13:53:20 +0200
Hi,

>I'm not sure I understand (in fact, I'm fairly sure I don't
>understand) If you really need an apply-import's like
>behaviour you can use a matching one in a special mode
>(matching a more or less arbitrary node, such as /)

Yes, but in most cases I don't want to match a node in some mode, but rather
just say "add figure title formatting properties into this FO" and attribute
sets suit that need perfectly. If an importing stylesheet wants to override
only e.g. font weight, they don't have to redeclare the other attributes.
Naturally I could have

<xsl:template match="figure/title">
  <fo:block>
    <xsl:apply-templates select="." mode="formatting-properties"/>
    <xsl:apply-templates/>
  </>
</>

<xsl:template match="figure/title"  mode="formatting-properties">
  <xsl:attribute name="font-size">10pt</>
</>

And the importing stylesheet could then just declare

<xsl:template match="figure/title"  mode="formatting-properties">
  <xsl:apply-imports/>
  <xsl:attribute name="font-size">10pt</>
</>

But thus far attribute sets have done the job even with the limitation of not
being able to use them conditionally.

Jarno

Current Thread