homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Formatting tags depending on their attributes?

10+ Year Member

Msg#: 988 posted 7:16 am on May 5, 2003 (gmt 0)

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



10+ Year Member

Msg#: 988 posted 4:32 pm on May 5, 2003 (gmt 0)

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 = '';

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


10+ Year Member

Msg#: 988 posted 6:14 am on May 6, 2003 (gmt 0)

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved