W3C home > Mailing lists > Public > www-xsl-fo@w3.org > May 2003

Variables in xsl:use-attribute-sets

From: Marilu A. Hoeppner <hoeppner@ncbi.nlm.nih.gov>
Date: Thu, 1 May 2003 14:10:07 -0400
To: <www-xsl-fo@w3.org>
Message-ID: <1057787599.IAA22192@phantom.w3.org>


I need to display keywords and phrases that are tagged using <txtstyle
type="someStyle">.  My input XML looks like this.
<p>This is a <txtstyle type="style1">command</txtstyle> that I want
displayed in a certain style. This is a second <txtstyle
type="style2">command</txtstyle> that I want displayed in another

The corresponding styles are defined in a group of <xsl:attribute-set>
<xsl:attribute-set name="style1">
	<xsl:attribute name="color">red</xsl:attribute>
<xsl:attribute-set name="style2">
	<xsl:attribute name="color">blue</xsl:attribute>

I have defined a variable in the template to read the "type" attribute
value of the txtstyle element (i.e., style name) from the xml document.
I want to be able to use the value of the variable to call the attribute
<xsl:template match="txtstyle">
	<xsl:variable name="myStyle">
		<xsl:value-of select="@type"/>
	<xsl:if test="@type = $myStyle">
		<fo:inline xsl:use-attribute-sets="$myStyle">

However, the output file contains the <fo:inline>tagged text</fo-inline>
without the appropriate attributes as follows:
<fo:block>This is a <fo:inline>command</fo:inline> that I want displayed
in a certain style. This is a second <fo:inline>command</fo:inline> that
I want displayed in another style...</fo:block>

I would appreciate any help on this problem.

Marilu A. Hoeppner, Ph.D.
National Center for Biotechnology Information (NCBI)
Tel: 301-496-4911
Received on Thursday, 1 May 2003 14:14:21 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:27 UTC