x:inlucde background color
Oxygen general issues.
-
- Posts: 27
- Joined: Tue Nov 17, 2009 10:16 pm
x:inlucde background color
Post by guna@ebscohost.com »
Hi,
we are including x:include inside the document, we want to change the background color of x:include content
say if href starts with s, then use x color
if href starts with r, the use y color
if href starts with any other color, then use z color
can you guide us how to implement this
we are including x:include inside the document, we want to change the background color of x:include content
say if href starts with s, then use x color
if href starts with r, the use y color
if href starts with any other color, then use z color
can you guide us how to implement this
-
- Posts: 9508
- Joined: Fri Jul 09, 2004 5:18 pm
Re: x:inlucde background color
Hi,
This is too complex to do with CSS selectors. In the ExtensionsBundle you have to overwrite the createAuthorStylesFilter() method and assign styles on the xi:include content nodes. Here is some code, I made some comments.
Regards,
Radu
This is too complex to do with CSS selectors. In the ExtensionsBundle you have to overwrite the createAuthorStylesFilter() method and assign styles on the xi:include content nodes. Here is some code, I made some comments.
Code: Select all
/**
* @see ro.sync.ecss.extensions.api.ExtensionsBundle#createAuthorStylesFilter()
*/
@Override
public StylesFilter createAuthorStylesFilter() {
return new StylesFilter() {
public String getDescription() {
return "Custom reference colors";
}
public Styles filter(Styles styles, AuthorNode authorNode) {
if(authorNode.getName().equals("#reference")){
//This is an artificial node which represents the referenced content.
//Its parent is the xi:include
//Its href value is the "href" of the xi:include made absolute
//If you want the original value of the "href" you take this node's parent and get its href.
AttrValue attribute = ((AuthorElement)authorNode).getAttribute("href");
if(attribute != null) {
String hrefVal = attribute.getValue();
if(hrefVal.endsWith("section1.xml")) {
styles.setProperty(Styles.KEY_BACKGROUND_COLOR, new ro.sync.exml.view.graphics.Color(40, 40, 40));
return styles;
} else if(hrefVal.endsWith("section2.xml")) {
styles.setProperty(Styles.KEY_BACKGROUND_COLOR, new ro.sync.exml.view.graphics.Color(100, 100, 100));
return styles;
} else {
styles.setProperty(Styles.KEY_BACKGROUND_COLOR, new ro.sync.exml.view.graphics.Color(150, 150, 150));
return styles;
}
}
}
return null;
}
};
}
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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