[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] dynamically generate value for xsl:use-attribute-sets?
From: "Mario Madunic" <Mario_Madunic@xxxxxxxxxxxx>
Date: Wed, 3 Feb 2010 11:00:55 -0600

Thanks Wendell for the insight and a solution.

Marijan (Mario) Madunic
Publishing Specialist
New Flyer Industries

-----Original Message-----
From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx]
Sent: Wednesday, February 03, 2010 10:47 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] dynamically generate value for xsl:use-attribute-sets?

Mario,

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}">
>    ...
></fo:block>
>
>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.)

So:

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

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

... etc ...

then

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

>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.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
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
======================================================================


--------------------------------------------------------------------
Please consider the environment before printing this e-mail.

CONFIDENTIALITY STATEMENT: This communication (and  any and all information or
material transmitted with this communication) is confidential, may be
privileged and is intended only for the use of the intended recipient. If you
are not the intended recipient, any review, retransmission, circulation,
distribution, reproduction, conversion to hard copy, copying or other use of
this communication, information or material is strictly prohibited and may be
illegal. If you received this communication in error or if it is forwarded to
you without the express authorization of New Flyer, please notify us
immediately by telephone or by return email and permanently delete the
communication, information and material from any computer, disk drive,
diskette or other storage device or media. Thank you.


Current Thread
Keywords