how to format combined attributes with CSS

Questions about XML that are not covered by the other forums should go here.
m.exel
Posts: 2
Joined: Fri Jul 03, 2009 12:15 am

how to format combined attributes with CSS

Post by m.exel »

Hello,

i have a XML-File which will be formatted with CSS.
I want to format an element named "foo" with attribute "style". style follows rules in xhtml, e.g. style="border-bottom:solid; border-bottom-color:red".
Now i want to format the element foo. How i can i do that?

example in code:

Code: Select all

<foo style="border-bottom:solid; border-bottom-color:red">
this text should have a border at the bottom colored in red.
</foo>
thank you

Michael
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: how to format combined attributes with CSS

Post by Radu »

Dear Michael,

If you are referring to building a CSS file to display the XML in the Oxygen Author page I think you can accomplish what you want with the following CSS rule:

Code: Select all


foo{
border-bottom:replace(attr(style), "(.*)(border-bottom:)([ ]*)([a-z]+|#[a-fA-F0-9]{3,6})(.*)", "$4", true);
border-bottom-color:replace(attr(style), "(.*)(border-bottom-color:)([ ]*)([a-z]+|#[a-fA-F0-9]{3,6})(.*)", "$4", true);
}
This will work only in Oxygen because it uses the Oxygen extension function replace which applies a regular expression match on the attribute value.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
m.exel
Posts: 2
Joined: Fri Jul 03, 2009 12:15 am

Re: how to format combined attributes with CSS

Post by m.exel »

Hello Radu,

thank you very much for very fast reply!
I think i should read the manual.

Best regards

Michael
Post Reply