How to style fragment of a text in another styled text?
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 59
- Joined: Tue Sep 13, 2022 4:13 pm
How to style fragment of a text in another styled text?
Hello!
Is there any way to control the appearance of a selected piece of text ?
For example, in a topic title (not in toc or in bookmarks, only in topic):
"Below you can find the list (assets):" - where bolded text highlighted not only by "bold" property, but also with another font, another size of font, color etc.
Similarly, how to highlight a piece of text inside a body of a topic? Frequently, this need in a technical texts about programming, like this:
"This function (void result) returns the result if..." - in this example, required as i said above, to highlight bolded fragment not only by "bold" property, but also with another font, another size of font, color etc.
In both cases listed above, it is also necessary to somehow simplify this process, due to some kind of automation ...
For example, by assigning this action to some kind of "hot keys", since there are a lot of similar ones, and without this - it will be very difficult to style up a document...
Thank you in advance for your response!
Is there any way to control the appearance of a selected piece of text ?
For example, in a topic title (not in toc or in bookmarks, only in topic):
"Below you can find the list (assets):" - where bolded text highlighted not only by "bold" property, but also with another font, another size of font, color etc.
Similarly, how to highlight a piece of text inside a body of a topic? Frequently, this need in a technical texts about programming, like this:
"This function (void result) returns the result if..." - in this example, required as i said above, to highlight bolded fragment not only by "bold" property, but also with another font, another size of font, color etc.
In both cases listed above, it is also necessary to somehow simplify this process, due to some kind of automation ...
For example, by assigning this action to some kind of "hot keys", since there are a lot of similar ones, and without this - it will be very difficult to style up a document...
Thank you in advance for your response!
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: How to style fragment of a text in another styled text?
Post by chrispitude »
Hi Dan,
I think you will want to wrap these text fragments in some kind of element, then apply styling to these elements in both the Oxygen editor and in your transformations.
Are there existing DITA elements that semantically match the text you are wrapping? For example, if you look at
3.10.7 Technical-content domains elements
there might be elements in some of the domains (like in programming, user interface, etc.) that you can use.
If no existing DITA elements are a good match, then you could wrap in <ph> elements with special @outputclass values (not very convenient), or you could specialize your own DITA elements (which is manually easier to apply as you asked about).
I think you will want to wrap these text fragments in some kind of element, then apply styling to these elements in both the Oxygen editor and in your transformations.
Are there existing DITA elements that semantically match the text you are wrapping? For example, if you look at
3.10.7 Technical-content domains elements
there might be elements in some of the domains (like in programming, user interface, etc.) that you can use.
If no existing DITA elements are a good match, then you could wrap in <ph> elements with special @outputclass values (not very convenient), or you could specialize your own DITA elements (which is manually easier to apply as you asked about).
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: How to style fragment of a text in another styled text?
Post by chrispitude »
Sure!
I should explain that the reason an element (DITA-standard or specialized) is easier than using @outputclass is that
I should explain that the reason an element (DITA-standard or specialized) is easier than using @outputclass is that
- It captures the semantic meaning in the most structurally straightforward way
- It is easiest to apply in Oxygen by selecting text, then pressing Enter to wrap the text (and as a bonus, Oxygen remembers the most recently used elements, which makes it even easier)
-
- Posts: 59
- Joined: Tue Sep 13, 2022 4:13 pm
Re: How to style fragment of a text in another styled text?
Can you explain (shortly) in common, step-by-step , how to do this wrapping correctly?
Because i'm doing this and getting very strange result:-)))
For example: i need to style some term in a first column of a table.
i'm going by path: select term - right click - other actions - refactoring - elements - wrap element - codeblock.
And this styles whole table instead of a 1 term and produces a lot of errors underlined in red
))
Sorry, but i I haven't done this before...
Because i'm doing this and getting very strange result:-)))
For example: i need to style some term in a first column of a table.
i'm going by path: select term - right click - other actions - refactoring - elements - wrap element - codeblock.
And this styles whole table instead of a 1 term and produces a lot of errors underlined in red

Sorry, but i I haven't done this before...
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: How to style fragment of a text in another styled text?
Post by chrispitude »
Hi Dan,
Does this help?
After you select a text fragment, you press the Enter key and select the desired element. Oxygen places the most recently used element at the top of that list, so the next time you select a text fragment, you can simply press Enter, Enter (twice) to wrap it in that same element.
Does this help?
oxygen_wrapping_text.gif
After you select a text fragment, you press the Enter key and select the desired element. Oxygen places the most recently used element at the top of that list, so the next time you select a text fragment, you can simply press Enter, Enter (twice) to wrap it in that same element.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 59
- Joined: Tue Sep 13, 2022 4:13 pm
Re: How to style fragment of a text in another styled text?
Thank you very much, Chrispitude!
This is exactly what i need! Because i'm just a newbee in Oxygen.
And I’ll ask you another question to close this topic for myself: if I need to use not standard selection options, but define some kind of my own font style for highlighting? You wrote about it above. Why I'm asking: management wants (in a future) to switch to another font family and can give me such a task.
Could you briefly show how this is done? Sorry in advance if I'm asking too much...
This is exactly what i need! Because i'm just a newbee in Oxygen.
And I’ll ask you another question to close this topic for myself: if I need to use not standard selection options, but define some kind of my own font style for highlighting? You wrote about it above. Why I'm asking: management wants (in a future) to switch to another font family and can give me such a task.
Could you briefly show how this is done? Sorry in advance if I'm asking too much...
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: How to style fragment of a text in another styled text?
Post by chrispitude »
Hi Dan,
If you are using the following transformation types:
Your best bet at this point would be to read the Oxygen documentation for more information on CSS styling, and also to look on Syncro Soft's YouTube channel for tutorial videos:
https://www.youtube.com/user/oxygenxml
But that's a very broad topic to try to cover in this reply.
If you are using the following transformation types:
- DITA Map PDF - based on HTML5 & CSS
- DITA Map WebHelp Responsive
Your best bet at this point would be to read the Oxygen documentation for more information on CSS styling, and also to look on Syncro Soft's YouTube channel for tutorial videos:
https://www.youtube.com/user/oxygenxml
But that's a very broad topic to try to cover in this reply.
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: How to style fragment of a text in another styled text?
Post by julien_lacour »
Hi Dan,
In addition to what Chris said, here are some more links to our documentation and to some webinars that will surely help you: They are for PDFs but as Chris mentioned you can customize both WebHelp Responsive and PDF using HTML5&CSS using common CSS stylesheets.
Regards,
Julien
In addition to what Chris said, here are some more links to our documentation and to some webinars that will surely help you: They are for PDFs but as Chris mentioned you can customize both WebHelp Responsive and PDF using HTML5&CSS using common CSS stylesheets.
Regards,
Julien
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: How to style fragment of a text in another styled text?
Post by chrispitude »
And there is also the Oxygen Styles Basket, an interactive way to define your own look and feel:
Oxygen Styles Basket
This is intended for generating a global look and feel, but you could modify the result to add specific formatting rules for your particular elements of interest.
Oxygen Styles Basket
This is intended for generating a global look and feel, but you could modify the result to add specific formatting rules for your particular elements of interest.
-
- Posts: 59
- Joined: Tue Sep 13, 2022 4:13 pm
Re: How to style fragment of a text in another styled text?
Thanks to all who responded! I could not write right away - I was busy with work. Yes, I use DITA Map PDF - based on HTML5 & CSS for pdf output and more or less began to understand this process. If I understand correctly, oxygen has built-in CSS, which we cannot change, we can only see which part of it is responsible for what. And using this information, - "redefine" some things, using the "custom CSS" attached in the export scenario. I already do this and it turns out (as I think
).
My question was about something else...
Just above, chrispitude showed the sequence of selecting a predefined style from the context menu (which appears when you press Enter).
My question was this: can I create my own font style and have it appear in this context menu (this would be good for speeding up work)?
I repeat: the reason for my question is that the management wants to switch (in a month) to a font that is definitely not in oXygen (I have already learned how to include custom fonts in CSS. And here's how to make a "style" out of it that would appear when you click on Enter - that would be very interesting).

My question was about something else...
Just above, chrispitude showed the sequence of selecting a predefined style from the context menu (which appears when you press Enter).
My question was this: can I create my own font style and have it appear in this context menu (this would be good for speeding up work)?
I repeat: the reason for my question is that the management wants to switch (in a month) to a font that is definitely not in oXygen (I have already learned how to include custom fonts in CSS. And here's how to make a "style" out of it that would appear when you click on Enter - that would be very interesting).
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: How to style fragment of a text in another styled text?
Post by chrispitude »
Hi Dan,
Yes, you can define your own fonts to be used in both the Oxygen editor and in PDF/WebHelp outputs.
What element or attribute are you using to apply your styling? I could put together a small Oxygen project to demonstrate how this works.
- Chris
Yes, you can define your own fonts to be used in both the Oxygen editor and in PDF/WebHelp outputs.
What element or attribute are you using to apply your styling? I could put together a small Oxygen project to demonstrate how this works.
- Chris
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: How to style fragment of a text in another styled text?
Post by julien_lacour »
Hi Dan,
There's also a topic in our user-guide explaining how to set fonts in Oxygen:
- https://www.oxygenxml.com/doc/versions/ ... fonts.html
Regards,
Julien
There's also a topic in our user-guide explaining how to set fonts in Oxygen:
- https://www.oxygenxml.com/doc/versions/ ... fonts.html
Regards,
Julien
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: How to style fragment of a text in another styled text?
Post by chrispitude »
Hi Dan,
To clarify - the context menu shows elements, not fonts. You need to wrap content in an element, then style that element in a particular font.
To clarify - the context menu shows elements, not fonts. You need to wrap content in an element, then style that element in a particular font.
-
- Posts: 59
- Joined: Tue Sep 13, 2022 4:13 pm
Re: How to style fragment of a text in another styled text?
Thank you all for your help, I seem to be able to figure it out.
As far as I understand, the system works like this:
1) I select a section of text (for example, using msgph)
2) in the self-made CSS file connected for output, I add a redefinition of some parameters or I add new parameters to the class that is responsible for the design of this element (for example, in the case of msgph, this is *[class~='pr-d/codeph']
This is clear and I got it right.
But I would like to return to the previous question. This way is to "override" an existing preset using CSS.
Is it possible to make changes to the default preset?
For example, even Microsoft Word has the ability to "update font style settings - using the current settings." Is there something similar in oxygen?
So that I can either:
a) make changes to the default font style (which appears in the context menu when you press Enter)
or
b) create your own font style (which appears in the context menu when you press Enter)?
I may not be speaking correctly, but I hope you could understand me...
My main goal is to speed up the work....
In the course of studying all this, I had a couple more questions (which I tried to solve, but could not):
1) how to quickly remove the style applied to a section of text (say, the same msgph), so that the section of text is no longer selected?
2) How to quickly select a column in a table or a row of cells by applying to them, for example, "msgph"? What is it for: we have pieces of code in the first column of the table, and other columns explain this code. Simply making changes to the *[class~='topic/entry'] class will not do anything, as it will format the entire table. And I need only the first column. How to solve it?
Thank you all in advance!
As far as I understand, the system works like this:
1) I select a section of text (for example, using msgph)
2) in the self-made CSS file connected for output, I add a redefinition of some parameters or I add new parameters to the class that is responsible for the design of this element (for example, in the case of msgph, this is *[class~='pr-d/codeph']
This is clear and I got it right.
But I would like to return to the previous question. This way is to "override" an existing preset using CSS.
Is it possible to make changes to the default preset?
For example, even Microsoft Word has the ability to "update font style settings - using the current settings." Is there something similar in oxygen?
So that I can either:
a) make changes to the default font style (which appears in the context menu when you press Enter)
or
b) create your own font style (which appears in the context menu when you press Enter)?
I may not be speaking correctly, but I hope you could understand me...

My main goal is to speed up the work....
In the course of studying all this, I had a couple more questions (which I tried to solve, but could not):
1) how to quickly remove the style applied to a section of text (say, the same msgph), so that the section of text is no longer selected?
2) How to quickly select a column in a table or a row of cells by applying to them, for example, "msgph"? What is it for: we have pieces of code in the first column of the table, and other columns explain this code. Simply making changes to the *[class~='topic/entry'] class will not do anything, as it will format the entire table. And I need only the first column. How to solve it?
Thank you all in advance!
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: How to style fragment of a text in another styled text?
Post by chrispitude »
Hi Dan,
The fonts in the Oxygen interface and the fonts in your output transformations are independent. To configure the fonts in the Oxygen interface, you can go into Tools > Preferences > Appearance > Fonts.
DITA allows more specific elements to be specialized from more general elements. If you open Window > Show View > Attributes and put your cursor inside a <codeph> element, you will see that its @class attribute value is "+ topic/ph pr-d/codeph". So, you can decide how specifically or how generally to apply your CSS to the element.
To quickly ungroup an element but leave its content in place, select the element, right-click, and choose Refactoring > Delete Element Tags. (This does not delete the entire element; it just ungroups it.) There is a default shortcut that you can see in the menu, and you can change this hotkey to something more memorable if you want.
Here is a testcase showing how to use the same CSS file in both the Oxygen editing window and in PDF output:
In this testcase, the CSS file highlights <codeph> elements in yellow . There is an extension to the DITA framework that makes the CSS file available in the editor:
In our environment, we have extensive CSS styling that is shared between the Oxygen editor, PDF output, and WebHelp output. This allows writers to see the content in the Oxygen editor as it will appear in the outputs (almost). There are many CSS interesting problems to solve when doing this, and I hope to write an Oxygen blog post on it soon.
I don't know how to apply an operation to a table column, but it would be interesting to learn if there was such a way!
The fonts in the Oxygen interface and the fonts in your output transformations are independent. To configure the fonts in the Oxygen interface, you can go into Tools > Preferences > Appearance > Fonts.
DITA allows more specific elements to be specialized from more general elements. If you open Window > Show View > Attributes and put your cursor inside a <codeph> element, you will see that its @class attribute value is "+ topic/ph pr-d/codeph". So, you can decide how specifically or how generally to apply your CSS to the element.
To quickly ungroup an element but leave its content in place, select the element, right-click, and choose Refactoring > Delete Element Tags. (This does not delete the entire element; it just ungroups it.) There is a default shortcut that you can see in the menu, and you can change this hotkey to something more memorable if you want.
Here is a testcase showing how to use the same CSS file in both the Oxygen editing window and in PDF output:
oxygen_for_dan.zip
In this testcase, the CSS file highlights <codeph> elements in yellow . There is an extension to the DITA framework that makes the CSS file available in the editor:
image.png
In our environment, we have extensive CSS styling that is shared between the Oxygen editor, PDF output, and WebHelp output. This allows writers to see the content in the Oxygen editor as it will appear in the outputs (almost). There are many CSS interesting problems to solve when doing this, and I hope to write an Oxygen blog post on it soon.
I don't know how to apply an operation to a table column, but it would be interesting to learn if there was such a way!
You do not have the required permissions to view the files attached to this post.
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: How to style fragment of a text in another styled text?
Post by julien_lacour »
Hi Dan and Chris,
Regarding the "operation to a table column" one possibility could be to create a custom operation that will appear in the XML Refactoring dialog.
Depending on your operation you can maybe use an already available operation (as Chris mentioned). The idea is to search for the needed action and use an XPath query that matches only the elements you want to update.
Regards,
Julien
Regarding the "operation to a table column" one possibility could be to create a custom operation that will appear in the XML Refactoring dialog.
Depending on your operation you can maybe use an already available operation (as Chris mentioned). The idea is to search for the needed action and use an XPath query that matches only the elements you want to update.
Regards,
Julien
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: How to style fragment of a text in another styled text?
Post by chrispitude »
Hi Julien,
That's a cool idea! I never thought about using a more complex XPath expression for element operation refactoring operations.
Hi Dan,
Try using the Wrap element content refactoring operation from the editor context menu like this:
If you have multiple tables, you will need to specify which one (table[1], table[2], and so on).
That's a cool idea! I never thought about using a more complex XPath expression for element operation refactoring operations.
Hi Dan,
Try using the Wrap element content refactoring operation from the editor context menu like this:
image.png
If you have multiple tables, you will need to specify which one (table[1], table[2], and so on).
You do not have the required permissions to view the files attached to this post.
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