Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 9th, 2008, 09:21 AM
Authorized User
 
Join Date: Jul 2008
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to set the backgound-color dynamically

Here m having a xml as:
<NewDataSet>
  <Detail>
    <idShiftNo>68</idShiftNo>
    <idEmployee>221263</idEmployee>
    <NameEmployee>Biswal, Sabine</NameEmployee>
    <Date>2007-01-05T00:00:00+05:30</Date>
    <Department>1</Department>
    <ShiftName>N2</ShiftName>
    <ShiftStart>2007-01-05T21:15:00+05:30</ShiftStart>
    <ShiftEnd>2007-01-05T22:00:00+05:30</ShiftEnd>
    <idTaskNo>323</idTaskNo>
    <strNameJob>BO</strNameJob>
    <idTaskNo1>323</idTaskNo1>
    <TaskStart>2007-01-05T21:15:00+05:30</TaskStart>
    <TaskEnd>2007-01-05T21:55:00+05:30</TaskEnd>
    <TaskName>OS217</TaskName>
    <intSchriftFarbe>0</intSchriftFarbe>
    <intHintergrundFarbe>12632256</intHintergrundFarbe>
  </Detail>


Then m using xslt so if used it as:
 <xsl:variable name ="taskname1" select ="intHintergrundFarbe"></xsl:variable>

<table>
                      <tr>
                        <td width="{$timestartshow}" id="name">
                          <div style="width:0;background-color:white; solid #000;">

                          </div>
                        </td>
                        <td>
                          <div style="width:{$timeendshow}; background-color:{$taskname1}; solid #000;">

                            <xsl:value-of select ="$taskname"/>

                          </div>
                        </td>

                      </tr>
                    </table>
it can't show the background color. so please help me in this case as in xslt how the div background-color changes dynamically
Please help me:(

Reply With Quote
  #2 (permalink)  
Old July 9th, 2008, 09:47 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

According to your sample data intHintergrundFarbe is equal to 12632256. This is not a valid HTML colour.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #3 (permalink)  
Old July 9th, 2008, 09:49 AM
Authorized User
 
Join Date: Jul 2008
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

so how should i convert it in Html format???


Reply With Quote
  #4 (permalink)  
Old July 9th, 2008, 10:18 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

I don't know - its not in any valid colour format that I've ever come across.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #5 (permalink)  
Old July 10th, 2008, 01:47 AM
Authorized User
 
Join Date: Jul 2008
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sir, as m searching on this, i come to know that this color code belongs to the access front-end color scheme, so now will u please help me to convert it into html color dynamically.
Thanx for ur reply :)


Reply With Quote
  #6 (permalink)  
Old July 10th, 2008, 03:16 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Ah, Microsoft Access - wonderful.

Well if your number is C then in terms of RGB colours it is C = R + G * 256 + B * 256 * 256
If you work this backwards using something like below you can get to R, G and B again:

    B = Int(C / 256 / 256)
    G = Int((C - B * 256 * 256) / 256)
    R = Int(C - B * 256 * 256 - G * 256)

However then you have a number between 0 and 255 - which you then have to convert into hex to supply as a HTML colour.

I hope that helps. From there I think you'll have to do the rest yourself as I don't have any more time.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #7 (permalink)  
Old July 10th, 2008, 03:41 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your HintergrundFarbe 12632256 translates to hexadecimal as C0C0C0, which looks like a plausible RGB colour code, so I suspect you just want to do a decimal-to-hex translation. You can do that either by calling an extension function, or by writing it yourself as a recursive function (or template, if you're in XSLT 1.0). Or in fact as it's always six hex digits you could just compute each digit separately: the hex value of the 4th hex digit for example is

substring("0123456789ABCDEF", 1 + (($in div 256) mod 16), 1)

Michael Kay
http://www.saxonica.com/

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #8 (permalink)  
Old July 10th, 2008, 07:17 AM
Authorized User
 
Join Date: Jul 2008
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx for all of u as now m atleast got an idea as how to convert it.
Thanx a lot!!! :)

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change the color of selected text dynamically NEO1976 Flash (all versions) 1 December 18th, 2007 11:11 AM
how we can set background color in xslt abhi.prince4u XSLT 2 July 4th, 2007 02:22 AM
Set Background color using RGb value sudarshan73 Reporting Services 1 January 11th, 2007 03:35 PM
CSS Backgound / Color warnings socoolbrewster CSS Cascading Style Sheets 3 January 4th, 2007 08:15 AM
set text color larry Javascript How-To 9 July 8th, 2004 01:01 AM



All times are GMT -4. The time now is 08:08 AM.


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