iswinky
iswinky

Reputation: 1969

XSL-FO use attributes dynamically

Can anyone explain why this doesn't work?

Attributes:

<xsl:attribute-set name="dark-red">
    <xsl:attribute name="color">red</xsl:attribute>
</xsl:attribute-set>

Template:

<xsl:template name="myTemplate">
    <xsl:param name="style">dark-red</xsl:param>
    <fo:block-container xsl:use-attribute-sets="{$style}">
        <fo:block>Not Red</fo:block>
    </fo:block-container>
</xsl:template>

However when not using a variable / parameter it seems to work:

<xsl:template name="myTemplate">
    <fo:block-container xsl:use-attribute-sets="dark-red">
        <fo:block>Red</fo:block>
    </fo:block-container>
</xsl:template>

Is there any particular reason for this or is there a way around it?

Upvotes: 0

Views: 1117

Answers (1)

Linga Murthy C S
Linga Murthy C S

Reputation: 5432

You cannot use dynamic values in xsl:use-attribute-sets. You would have to create required attributes in the elements.

Upvotes: 1

Related Questions