Welcome to WebmasterWorld Guest from 54.162.226.212

Forum Moderators: not2easy

Message Too Old, No Replies

Formatting tags depending on their attributes?

     
7:16 am on May 5, 2003 (gmt 0)

10+ Year Member



Hi, everybody!

Here's a little problem I have to solve right now. I am to write a stylesheet, which formats tags in an XML-File depending on the different attributes and their values.

For example:


<absatz typ="u">

has to look differently than

<absatz typ="gross">

and so on and so on

Problem is: the definition given to me by SelfHTML or the XMLBible (absatz[typ=u] or absatz[typ=gross]) does not work with Microsoft's IE. I am using version 6.0 of the IE, and it just does not react to my stylesheet.

If anybody has any idea on how to use the information given in the tag-attributes with my stylesheet, I would be very glad.

And I have to find a way, as I am not allowed to change the source-XML-File.

:)
Thanks for any help and suggestions!

Matthias Jenke

4:32 pm on May 5, 2003 (gmt 0)

10+ Year Member



MSIE does not support type selectors. But you have already found this out. I have used two ways to work around this with HTML:

1) If you have a "class" element in your XML, add a class identical to the type. For example:


<input type="button" class="button" value="foo" />

The recent thread on multiple classes [webmasterworld.com] is a helpful read in this case.

2) Use scripting to grab all of the nodes in the document and apply your styles dynamically based on a rule like:


if (node.type == "whatever") {
node.style.background = '';
[etc...]
}

Of course, that method depends on a client that supports scripting.

6:14 am on May 6, 2003 (gmt 0)

10+ Year Member



Hi, moonbiter!

Thanks for the suggestion. But the main problem is that I must not modify the xml-source-file, which means I cannot insert class-attributes.
But the problem might have been solved by the decision, that I am now allowed to build a stylesheet which works with Netscape 7.2, which is a great alleviation.

Just a pity that there are so many nice features in CSS that are not implemented in MSIE or Amaya (which I tried out for similar reasons).

:-)
Matthias Jenke

 

Featured Threads

Hot Threads This Week

Hot Threads This Month