|
Subject: [xsl] Extracting CSS Class from STYLE element From: David Carver <d_a_carver@xxxxxxxxx> Date: Tue, 16 Mar 2004 14:23:49 -0800 (PST) |
For those that are using Antenna House's XHTML2FO transformation, one
item it doesn't support is the ability to extract Style information
from a class attribute. The following bit of XSLT will allow you to
get this information and use it for formatting the XSLFO output. Just
add an xsl:if test after the @style test to call this template.
<xsl:template name="process-class">
<xsl:param name="class"/>
<!-- e.g., class="C7"
convert to text-align: center; color: red"
pass to process-style for additional processing -->
<xsl:variable name="styleClasses"
select="/html:html/html:head/html:style"/>
<xsl:variable name="elementName" select="translate(name(.),
'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
<xsl:variable name="findClass" select="concat($elementName, '.',
$class)"/>
<xsl:variable name="temp1" select="substring-after($styleClasses,
$findClass)"/>
<xsl:variable name="temp2" select="substring-after($temp1, '{')"/>
<xsl:variable name="styleList" select="substring-before($temp2, '}')"/>
<xsl:call-template name="process-style">
<xsl:with-param name="style" select="$styleList"/>
</xsl:call-template>
</xsl:template>
=====
"A good listener is a good talker with a sore throat." - Katharine Whitehorn
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Problem with grouping mul, James A. Robinson | Thread | [xsl] Using key to group large docu, Heinz Seldte |
| Re: [xsl] Omnimark vs. XSL (Saxon) , bry | Date | RE: [xsl] Removing leading zeros fr, Michael Kay |
| Month |