Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2009, 10:22 PM
Authorized User
 
Join Date: Aug 2009
Posts: 31
Thanks: 16
Thanked 1 Time in 1 Post
Default Put css value in variable

Code:
<style>
	.rowstyle1 { background-color: #D6F2EE;min-height: 50px;}
	.rowstyle2 { background-color: #F5F5F5;min-height: 50px; }
</style>
I could simply do:
Code:
<td class="rowstyle1">TEST</td>
But how do I put that value in a variable?

This doesn't work:
Code:
<xsl:variable name="rowstyle" select="rowstyle1" />

<td class="$rowstyle">TEST</td>
 
Old September 2nd, 2009, 02:43 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

It is a string, so you need to enclose it in quotes, else it will look for a XML element called rowstyle1.

<xsl:variable name="rowstyle" select="'rowstyle1'" />
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
The Following User Says Thank You to samjudson For This Useful Post:
kokoness (September 2nd, 2009)
 
Old September 2nd, 2009, 03:16 AM
Authorized User
 
Join Date: Aug 2009
Posts: 31
Thanks: 16
Thanked 1 Time in 1 Post
Default

Nice! :) Very nice.

I also needed to put the curly braces. Thanks Sam!

<td class="{$rowstyle}">TEST</td>





Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS - editing the css style sheet doesn't take effect immediately sayo ASP.NET 3.5 Basics 6 March 13th, 2009 02:32 AM
CSS HELP:! CSS EXPANDIBLE BACKGROUND FOR TITLE phpuser2000 CSS Cascading Style Sheets 2 December 19th, 2007 12:36 AM
Rich's new CSS book: Beginning CSS 2nd Edition jminatel BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 0 June 15th, 2007 11:55 AM
how to put result of shell function into variable method Beginning VB 6 1 April 20th, 2006 11:42 AM
put a space in between each variable crmpicco Javascript How-To 1 June 7th, 2005 11:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.