Use xml:lang in CSS Selector
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 170
- Joined: Thu Aug 30, 2018 10:06 pm
Use xml:lang in CSS Selector
Post by dreifsnider »
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'
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'
image.png
xml:lang='ja-JP'
image.png
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!
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 232
- Joined: Wed Aug 30, 2023 2:33 pm
Re: Use xml:lang in CSS Selector
Hello,
Thank you for reaching out.
Based on our public documentation, selectors of the type [*|lang] that match the lang attribute in any namespace are not supported [1].
You can remove the xml: prefix and use lang, for example [lang='en'].
Best,
Cosmin
[1] https://www.oxygenxml.com/doc/versions/ ... tions.html
Thank you for reaching out.
Based on our public documentation, selectors of the type [*|lang] that match the lang attribute in any namespace are not supported [1].
You can remove the xml: prefix and use lang, for example [lang='en'].
Best,
Cosmin
[1] https://www.oxygenxml.com/doc/versions/ ... tions.html
Cosmin Eftenie
www.oxygenxml.com
www.oxygenxml.com
-
- Posts: 170
- Joined: Thu Aug 30, 2018 10:06 pm
Re: Use xml:lang in CSS Selector
Post by dreifsnider »
Hi Cosmin,
Thanks for your reply and apologies for missing that entry in the public documentation.
Unfortunately, using lang does not seem to work for us, because even though a topic has "xml:lang='ja-JP'" the HTML lang still says "en", for example:
Daniel
Thanks for your reply and apologies for missing that entry in the public documentation.
Unfortunately, using lang does not seem to work for us, because even though a topic has "xml:lang='ja-JP'" the HTML lang still says "en", for example:
image.png
Thanks,Daniel
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 232
- Joined: Wed Aug 30, 2023 2:33 pm
Re: Use xml:lang in CSS Selector
Hello,
I apologize for the confusion. What I meant was that you should use the "lang" attribute in both the XML document and the CSS file, so that the correct rules are applied.
Best,
Cosmin
I apologize for the confusion. What I meant was that you should use the "lang" attribute in both the XML document and the CSS file, so that the correct rules are applied.
Best,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service