Wilhelmsen Tor Iver wrote:
It would be nice to use these features of XSL to make it easier to reuse the same attributes. Particularly in the first of these cases:


XSLT supports this already, but with a slightly different syntax to what you posted.


1) In the FO-generating stylesheet:

<xsl:attribute-set name="heading" fo:width="100%" fo:font-weight="bold" />

should be:

<xsl:attribute-set name="heading">
        <xsl:attribute name="width">100%</xsl:attribute>
        <xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>


...

<fo:block xsl:use="heading">...

<fo:block xsl:use-attribute-set="heading">


2) In FO (possibly generated from the XSL using xsl:element)

Is there a way to make FOP make the XSL transformer use xsl:attribute-set and xsl:use? Is a patch needed either in FOP or the transformer?

Theres no way of dynamically selecting the attribute set to use I'm afraid you have to hard code all possibilites upfront. E.g.

<xsl:choose>
<xsl:when test="name()='element1'>
        <element1 xsl:use-attribute-set="element1"/>
</xsl:when>
<xsl:when test="name()='element2'>
        <element2 xsl:use-attribute-set="element2"/>
</xsl:when>

....
</xsl:choose>     

Chris



Reply via email to