473,474 Members | 1,310 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

xslt variable a list of elements

1 New Member
I have program as follows, but color selection does not work. Does anyone know how to fix this?
fill="{($series_color)/color[$index+1]} this line seems not working, I got fill="" in Firefox and Chrome browser.

**********
Expand|Select|Wrap|Line Numbers
  1.     <xsl:variable name="series_color">
  2.         <color>#99FF99</color>
  3.         <color>#0099FF</color>
  4.         <color>#FF6600</color>
  5.         <color>#990099</color>
  6.         <color>#FF99FF</color>
  7.         <color>#666600</color>
  8.         <color>#CC99F0</color>
  9.         <color>#CC990F</color>
  10.         <color>#CC09FF</color>
  11.         <color>#0C99FF</color>
  12.         <color>#C599FF</color>
  13.         <color>#CC59FF</color>
  14.         <color>#CC95FF</color>
  15.         <color>#CC995F</color>
  16.     </xsl:variable>
  17.  
  18.     <xsl:template name="legend">
  19.         <xsl:variable name="width" select="100 div count(./series)"/>
  20.         <xsl:for-each select="./series">
  21.             <xsl:variable name="index" select="count(preceding::series)"/>
  22.             <rect x="{$index * $width}%" y="0" width="{$width}%" height="100%" fill="{($series_color)/color[$index+1]}" stroke="black" stroke-width="2"/>
  23.         </xsl:for-each>
  24.     </xsl:template>
Apr 30 '14 #1
1 2817
Dormilich
8,658 Recognized Expert Moderator Expert
I think it tries to do math rather than construct an XPath.
Apr 30 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Peter Ballard | last post by:
Whew. I hope that title is descriptive! Hi all, The python tutorial tells me "It is not safe to modify the sequence being iterated over in the loop". But what if my list elements are mutable,...
3
by: Benjamin Hillsley | last post by:
Hi, I have a xml file that catalogs my cd and dvd collection, and I am currently writing a web page to access this catalog. I would like to include a selection box that lists the CD's by...
3
by: yawnmoth | last post by:
I'm trying to center list elements in a webpage I'm working on, and setting margin-left to auto for ol (or ul) seems to prevent the number (or bullet) from displaying in IE6 (strict mode) and...
33
by: abs | last post by:
Hi all. My list: <ul> <li id="a" onclick="show(this)">Aaaaaaaa</li> <li id="b" onclick="show(this)">Bbbbbbbb</li> <li id="c" onclick="show(this)">Cccccccc <ul> <li id="d"...
2
by: Jon Martin Solaas | last post by:
Hi, I have a general document somewhat like this: -------------------------------------- <root> <level1> <level2> <interestingstuff number="2"/> <interestingstuff number="3"/>...
0
by: Origin | last post by:
Is there a way to programatically access Form elements that are added via an xslt document during transformation? I'm feeding an xml control both the xml document and the xslt document, which...
2
by: psbasha | last post by:
Hi, I am trying to assign the list elements(l1) to another list (l2).When I am trying to remove the element from l2,it is removing the element from l1. Is there any method available to copy the...
5
RMWChaos
by: RMWChaos | last post by:
I am working on a script to create and remove DOM elements, and I want to make it as efficient as possible (no redundancies). Because DOM elements each have their own set of attributes, the function...
1
Jezternz
by: Jezternz | last post by:
Scriptaculous needs an official forum but does not have one so I am asking here :). note you will need to be familiar with scriptaculous to help me here. Basicly I have a script that has a...
1
by: antar2 | last post by:
Hello Suppose I have a textfile (text1.txt) with following four words: Apple balcony cartridge damned paper
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.