473,372 Members | 950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

Noob Q: dynamic parameters and conditional styles?

kj


I have a dynamically generated HTML document that includes a table
of numbers. In this table, I want every number greater than some
numerical parameter MAX_VAL (also dynamically generated) to be
rendered as "> " followed by the string form of MAX_VAL. For
example, if MAX_VAL is 1000, and a row in this table consists of
the numbers 500, 1000, and 200, i.e.

<TR>
<TD CLASS="nifty" MAX_VAL=1000>500</TD>
<TD CLASS="nifty" MAX_VAL=1000>1000</TD>
<TD CLASS="nifty" MAX_VAL=1000>2000</TD>
</TR>

I want that row to be rendered like this:

| 500 | 1000 | > 1000 |

Can this be done with CSS? It would require at least three things
I don't know how to do:

* First, the CSS would have to be able to work with a user-defined
parameter (in this case MAX_VAL).

* Second, it would have to be able to produce different styles
conditional on the value of this parameter.

* And third, one of these styles must be able to incorporate the
string version of this user-defined parameter in the generated
output.

Is this a pipe dream?

Any clues on how this can be done would be much appreciated.

Thanks in advance!

kj

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Apr 24 '06 #1
4 1553
kj wrote:
I have a dynamically generated HTML document that includes a table
of numbers. In this table, I want every number greater than some
numerical parameter MAX_VAL (also dynamically generated) to be
rendered as "> " followed by the string form of MAX_VAL. For
example, if MAX_VAL is 1000, and a row in this table consists of
the numbers 500, 1000, and 200, i.e.

<TR>
<TD CLASS="nifty" MAX_VAL=1000>500</TD>
<TD CLASS="nifty" MAX_VAL=1000>1000</TD>
<TD CLASS="nifty" MAX_VAL=1000>2000</TD>
</TR>
This is not an HTML document as no version of HTML has a "MAX_VAL"
attribute.
I want that row to be rendered like this:

| 500 | 1000 | > 1000 |

Can this be done with CSS?
No.
* First, the CSS would have to be able to work with a user-defined
parameter (in this case MAX_VAL).
CSS can work with generic XML documents, so this isn't a problem (assuming
you started using XML)
* Second, it would have to be able to produce different styles
conditional on the value of this parameter.
Attribute selectors let you do this (although only on pattern matching,
maths isn't possible with them).
* And third, one of these styles must be able to incorporate the
string version of this user-defined parameter in the generated
output.
This is possible with the content property. (Well, ish).

You also would need the ability to process the content of the element.
Any clues on how this can be done would be much appreciated.


Transform it on the server and output the content you want to display.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Apr 24 '06 #2
KMA
Just an idea, but can't you get the server side generator to use two
classes, "nifty" and "Bignifty", then css can highlight the Bigniftys.

"kj" <so***@987jk.com.invalid> wrote in message
news:e2**********@reader1.panix.com...


I have a dynamically generated HTML document that includes a table
of numbers. In this table, I want every number greater than some
numerical parameter MAX_VAL (also dynamically generated) to be
rendered as "> " followed by the string form of MAX_VAL. For
example, if MAX_VAL is 1000, and a row in this table consists of
the numbers 500, 1000, and 200, i.e.

<TR>
<TD CLASS="nifty" MAX_VAL=1000>500</TD>
<TD CLASS="nifty" MAX_VAL=1000>1000</TD>
<TD CLASS="nifty" MAX_VAL=1000>2000</TD>
</TR>

I want that row to be rendered like this:

| 500 | 1000 | > 1000 |

Can this be done with CSS? It would require at least three things
I don't know how to do:

* First, the CSS would have to be able to work with a user-defined
parameter (in this case MAX_VAL).

* Second, it would have to be able to produce different styles
conditional on the value of this parameter.

* And third, one of these styles must be able to incorporate the
string version of this user-defined parameter in the generated
output.

Is this a pipe dream?

Any clues on how this can be done would be much appreciated.

Thanks in advance!

kj

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.

Apr 25 '06 #3

kj wrote:
Can this be done with CSS?


No.

It might almost be possible using attribute selectors, _IF_ your
problem were only a little simpler and just required an equality test,
not a comparison. However even then you'd be relying on CSS features
of recent spec versions that aren't widely supported. It wouldn't work,
it wouldn't work if CSS was unavailable, it wouldn't work on older
browsers, it wouldn't be at all accessible and most of all it's pretty
contrary to the whole ethos of CSS.

Don't use CSS to mess with content. Use it to present content that you
already have.

I'd suggest some scripting (ideally server-side, but client side would
be OK) that sets a class attribute value of "max-exceeded" onto the
rows >MAX_VAL. CSS could then colour these rows accordingly.

CSS _could_ even change the presentation of the large value into
invisiblilty and a flat text warning message "> MAX", if this class was
set. This would be possible, even quite easy to do, but it wouldn't be
portable (IE is still too broken and too commonplace). Technically
you could do this, practically you shouldn't.

Apr 25 '06 #4
kj <so***@987jk.com.invalid> writes:
<TR>
<TD CLASS="nifty" MAX_VAL=1000>500</TD>
<TD CLASS="nifty" MAX_VAL=1000>1000</TD>
<TD CLASS="nifty" MAX_VAL=1000>2000</TD>
</TR>

I want that row to be rendered like this:

| 500 | 1000 | > 1000 |

Can this be done with CSS?


That's a perfectly fair question. CSS is about presentation, and what
you're specifying is presentation.

But from a CSS standpoint, what you're specifying is content. It's
better not to try to do it with CSS.

You've stumbled upon an important point that is often missed. Many
server-side frameworks out there seek to enforce that presentation
specification and logic/content specification stay on their own sides of
the line. The problem is, often there's no line.

--

http://ourdoings.com/ Easily organize and disseminate news and
photos for your family or group.
Apr 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: znelson | last post by:
I'm looking for a way to transform the contents of n source tables into a single destination table. This by itself is no problem. However, the name of the source tables change, so I'll need to...
0
by: Martin Buchleitner | last post by:
Hi ! At the moment i split the document into seperate NodeSets which consist of one 'style1' block. This block goes either until the end of the document or until another 'style1' block appears....
28
by: Benjamin Niemann | last post by:
Hello, I've been just investigating IE conditional comments - hiding things from non-IE/Win browsers is easy, but I wanted to know, if it's possible to hide code from IE/Win browsers. I found...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
0
by: jason | last post by:
Playing around with asp.net 2.0 and asp:menu for the first time.. what's the attribute/code so that each item in my menu has a *SEPERATE* border around it? Seems I can only make the border around...
3
by: brian.turner | last post by:
This is sort of a design/javascript question. It involves CSS rendering in dynamic areas of a page using IE. E 6 & 7 HI There, We've created some example static html pages (using CSS) that...
4
by: jobs | last post by:
1. How do I pass a subroutine a reference of an object? For example I have variable datef type datetime. I want to pass to pass datef the variable, not it's value to the sub? 2. In ADO.NET,...
1
by: Japskunk | last post by:
I am having trouble updating a SQL table through the GridView "Auto" Enable Edit Feature... I am connecting to a SQL 2000 Server with a SQLDataSource I have created the Update Query in the Command...
2
by: pinman | last post by:
hi. i'm pretty much a noob to c# and visual studio and am trying to create a simple login method. i have created a users table in the database and can add users by inputing there md5 encrypted...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.