xsl-list
[Top] [All Lists]

dynamic usage of attribute sets

2002-10-21 06:30:18
Hello,

this time I have a question regarding attribute sets. I create a table in XSL FO and have one template for creating the cells:

<xsl:template match="iupb:cell">
  <fo:table-cell xsl:use-attribute-sets="table-cell">
    <fo:block wrap-option="no-wrap">
<xsl:variable name="value" select="iupb:value0|@iupb:value0|@iupb:value1"/>
      <xsl:choose>
        <xsl:when test="$value = 'nd'"></xsl:when>
        <xsl:when test="@iupb:type = 'AMOUNT'">
          <xsl:value-of select="format-number($value div 100000, '#.##0')"/>
        </xsl:when>
        <xsl:when test="not(@iupb:type) or @iupb:type = 'LABEL'">
          <xsl:value-of select="$value"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="format-number($value, '#.##0')"/>
        </xsl:otherwise>
      </xsl:choose>
    </fo:block>
  </fo:table-cell>
</xsl:template>

Now I want to use a different attribute set for header cells. According to the spec http://www.w3.org/TR/xslt#attribute-sets only QNames are allowed as value for use-attribute-sets, but not expressions. So I must assume, that it is not possible in general. But has somebody a workaround. Until now I must add the special attributes via <xsl:attribute>:

  <fo:table-cell xsl:use-attribute-sets="table-cell">
    <xsl:if test="parent::iupb:header-cell">
      <xsl:attribute name="font-weight">bold</xsl:attribute>
      <xsl:attribute name="text-align">center</xsl:attribute>
    </xsl:if>
    ...
  </fo:table-cell>

For a third type (column headers vs. row headers) I had to add still more <xsl:attribute/>s. Does anybody know a smarter way to achieve "dynamic attribute-sets"?

Regards,

Joerg

--

System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg(_dot_)heinicke(_at_)virbus(_dot_)de
www.virbus.de

VIRBUS hat jetzt als erster deutscher Softwarehersteller die Zertifizierung für den 3D Secure-Authentifizierungsstandard "Verified by Visa" erhalten. Details unter http://www.virbus.de/de/press/pressemitteilung/20020828_verified_by_VISA.


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>