[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Extracting CSS Class from STYLE element

Subject: Extracting CSS Class from STYLE element
From: David Carver <d_a_carver@xxxxxxxxx>
Date: Tue, 16 Mar 2004 14:23:49 -0800 (PST)
xsl css class
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.