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: <002201c3100c$e66497f0$4f140e82@ncbi.nlm.nih.gov>

Hi,

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
style...</p>


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

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
set. 
<xsl:template match="txtstyle">
	<xsl:variable name="myStyle">
		<xsl:value-of select="@type"/>
	</xsl:variable>
	<xsl:if test="@type = $myStyle">
		<fo:inline xsl:use-attribute-sets="$myStyle">
			<xsl:apply-templates/>
		</fo:inline>
	</xsl:if>
</xsl:template>

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


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

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:10 GMT