Xslt XSL-FO动态使用属性

Xslt XSL-FO动态使用属性,xslt,xsl-fo,Xslt,Xsl Fo,有人能解释为什么这不起作用吗 属性: <xsl:attribute-set name="dark-red"> <xsl:attribute name="color">red</xsl:attribute> </xsl:attribute-set> <xsl:template name="myTemplate"> <xsl:param name="style">dark-red</xsl:param&g

有人能解释为什么这不起作用吗

属性:

<xsl:attribute-set name="dark-red">
    <xsl:attribute name="color">red</xsl:attribute>
</xsl:attribute-set>
<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>

红色
模板:

<xsl:attribute-set name="dark-red">
    <xsl:attribute name="color">red</xsl:attribute>
</xsl:attribute-set>
<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>

深红色
不是红色的
但是,当不使用变量/参数时,它似乎起作用:

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

红色

这有什么特别的原因吗?或者有办法解决吗?

您不能在
xsl:use attribute set
中使用动态值。您必须在元素中创建必需的属性