[xsl] The use of a variable in use-attribute-sets attribute

Subject: [xsl] The use of a variable in use-attribute-sets attribute
From: Joshua.Kuswadi@xxxxxxxxxxxxxxxxxxxx
Date: Tue, 15 May 2001 09:41:30 +1000
Hi all,

I can't find much documentation, aside from the spec, about the use of the use-attribute-sets attribute. I'm in the process of trying to write a stylesheet to transform one XSL document (that creates HTML) into another (that creates an XSL-FO). In my source document I have some code like:

<!-- some code -->
	<td class="classname">
		<!-- some more code -->
	</td>
<!-- some code -->

which I want to transform to 

<!-- some code -->
	<fo:table-cell font-size="12pt" font-weight="bold">
		<fo:block>
			<!-- some more code -->
		</fo:block>
	</fo:table-cell>
<!-- some code -->

I thought I had a brainwave in creating an XSL using attribute-sets to match each of the different HTML stylesheet classes, but using a variable for the value of the use-attribute-sets attribute doesn't appear to work. I also tried putting the variable select as an attribute, just in case, but with no success. Any ideas would be most appreciated, I think my problem is a lack of understanding of what a QName is.

Below is a snippet of the XSL code.

Thanks in advance,
Joshua

<!-- some code -->
<xsl:template match="td">
	<xsl:variable name="class">
		<xsl:value-of select="@class"/>
	</xsl:variable>
	<xsl:element name="fo:table-cell" use-attribute-sets="$class">
		<xsl:element name="fo:block">
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:element>
</xsl:template>

<xsl:attribute-set name="classname">
	<xsl:attribute name="font-size">12pt</xsl:attribute>
	<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
<!-- some code -->

------------------------------------------------------------------------------
This message and any attachment is confidential and may be privileged or otherwise protected from disclosure.  If you have received it by mistake please let us know by reply and then delete it from your system; you should not copy the message or disclose its contents to anyone.





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


Current Thread