Use xml:lang in CSS Selector
Posted: Tue Apr 08, 2025 2:59 am
Hi Oxygen Support,
My team would like to introduce some text before the contents of a topic that has a custom attribute (translated) set on the root <topic> element. We are hoping that the text can be localized depending on the value of the xml:lang attribute on the root <topic> element as well.
For example, here is a sample <topic> element that we would like to introduce the before text:
Here are examples of the two solutions we would like to have:
xml:lang='en-US' xml:lang='ja-JP' Here is the CSS that I'm hoping to use:
Unfortunately, the presence of xml:lang in the CSS selector doesn't seem to work as expected and the before text never displays. Removing the xml:lang selector causes the before text to display as expected, but we're hoping that we can have localized before text depending on the value of xml:lang.
Do you have any suggestions for how we can have localized text in the CSS before pseudo element in Web Author?
Thank you!
My team would like to introduce some text before the contents of a topic that has a custom attribute (translated) set on the root <topic> element. We are hoping that the text can be localized depending on the value of the xml:lang attribute on the root <topic> element as well.
For example, here is a sample <topic> element that we would like to introduce the before text:
Code: Select all
<topic xml:lang="en-US" id="example_1" translated="yes">
xml:lang='en-US' xml:lang='ja-JP' Here is the CSS that I'm hoping to use:
Code: Select all
*[class~='topic/topic'][translated='yes'] {
background-color: LightGray !important;
-oxy-editable: false;
}
*[xml:lang~='en-US'][class~='topic/topic'][translated='yes']:before {
content: 'The following content has been translated and is not editable';
color: red !important;
font-size: 26px;
text-decoration: none;
}
*[xml:lang~='ja-JP'][class~='topic/topic'][translated='yes']:before {
content: '以下のコンテンツは翻訳されており、編集できません';
color: red !important;
font-size: 26px;
text-decoration: none;
}
Do you have any suggestions for how we can have localized text in the CSS before pseudo element in Web Author?
Thank you!