Re: [xsl] dynamically generate value for xsl:use-attribute-sets?

Subject: Re: [xsl] dynamically generate value for xsl:use-attribute-sets?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 03 Feb 2010 11:47:29 -0500

At 11:22 AM 2/3/2010, you wrote:
I'm working in FO and would like to do the following:

<fo:block xsl:use-attribute-sets="as_SectionTOCTitleLvl{parent::*/@level}">

Error gets thrown up. Did a quick google search and seems that use-attribute-sets value cannot be dynamic.

No, but there are other ways to skin the same cat.

For example, you could have templates in a mode matching your @level attributes, distinguished by value, which add whichever attributes are peculiar to that particular level. Then just apply templates to parent::*/@level in that mode. (And use an attribute set for the attributes common to all levels.)


<xsl:template mode="TOCTitleLvl" match="@level[.='1']">
  <xsl:attribute name="font-size">125%</xsl:attribute>

<xsl:template mode="TOCTitleLvl" match="@level[.='2']">
  <xsl:attribute name="font-size">115%</xsl:attribute>
  <xsl:attribute name="font-style">italic</xsl:attribute>

... etc ...


<fo:block xsl:use-attribute-sets="as_SectionTOCTitle">
  <xsl:apply-templates mode="TOCTitleLvl" select="../@level"/>

So my question is, are there plans to allow this in a future XSLT recommendation?

Dunno. But from what I've seen, named attribute sets are rarely used outside the context of FO, so this requirement might not have gotten much attention.


Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

Current Thread