How to localize CSS generated content from Docbook l10n file
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 72
- Joined: Thu Mar 26, 2015 4:57 pm
How to localize CSS generated content from Docbook l10n file
Post by steve.cuzner »
I'd like to customize my framework CSS to generate content using the docbook localization files (oxygen_home/frameworks/docbook/xsl/common). I see there is a function described for localization of css,
But this uses the frameworks translation.xml file. Would using the oxy_xpath function as follows be a practical solution?
Would this cause the en.xml file to be opened multiple times and degrade performance or would it be cached (or is there a way to open once and cache) Is there a better way?
Steve
Code: Select all
title:before{
content:"${i18n(title.key)} : ";
}
Code: Select all
chapter > title:before,
chapter > info > title:before{
content:
oxy_xpath("doc('frameworks/docbook/xsl/common/en.xml'/l:l10n/l:gentext[@key='chapter'][1]/@text") counter(chapter_count, decimal) ": ";
counter-increment:chapter_count;
}
Steve
-
- Posts: 9449
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to localize CSS generated content from Docbook l10n
Hi Steve,
Just to see if I understand exactly:
You probably read this topic, right?
http://www.oxygenxml.com/doc/ug-oxygen/ ... works.html
And you want to change the CSSs used for editing Docbook content in Oxygen to use the static texts defined in those XML documents used to publish Docbook content. Interesting idea.
Indeed the oxy_xpath degrades performance both for the initial evaluation of the content and for editing.
In Oxygen 17 we added a new parameter to the oxy_xpath function called evaluate:
http://www.oxygenxml.com/doc/ug-oxygen/ ... ction.html
So if you would use oxy_xpath as in your small example you could probably specify static evaluation for it:
This would not mean that the en.xml is executed only once.
It will be executed once for each different XPath expression string.
So if you have 10 chapters, the xpath expression will be executed once.
But if you also have a section element for which you use a different xpath string, that other expression will also get evaluated once. Also when editing the expression will not be evaluated.
So static evaluation is more lightweight but the en.xml will get loaded multiple times, about a single time for each different element name on which you set the static content from the CSS.
Regards,
Radu
Just to see if I understand exactly:
You probably read this topic, right?
http://www.oxygenxml.com/doc/ug-oxygen/ ... works.html
And you want to change the CSSs used for editing Docbook content in Oxygen to use the static texts defined in those XML documents used to publish Docbook content. Interesting idea.
Indeed the oxy_xpath degrades performance both for the initial evaluation of the content and for editing.
In Oxygen 17 we added a new parameter to the oxy_xpath function called evaluate:
http://www.oxygenxml.com/doc/ug-oxygen/ ... ction.html
So if you would use oxy_xpath as in your small example you could probably specify static evaluation for it:
Code: Select all
content:
oxy_xpath("doc('../xsl/common/en.xml'/l:l10n/l:gentext[@key='chapter'][1]/@text", evaluate, static) counter(chapter_count, decimal) ": ";
It will be executed once for each different XPath expression string.
So if you have 10 chapters, the xpath expression will be executed once.
But if you also have a section element for which you use a different xpath string, that other expression will also get evaluated once. Also when editing the expression will not be evaluated.
So static evaluation is more lightweight but the en.xml will get loaded multiple times, about a single time for each different element name on which you set the static content from the CSS.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 72
- Joined: Thu Mar 26, 2015 4:57 pm
Re: How to localize CSS generated content from Docbook l10n
Post by steve.cuzner »
Hi Radu,
Thanks for the info and you did understand my question perfectly. We really want to have a single source for our generated text content and replicating the data from the docbook l10n files to the translation.xml file is not ideal. We'll probably derive the translation.xml file from the l10n files in our build system. But just to clarify, does the translation.xml file get read once to increase performance?
BTW, the new features in 17 are great and I can't wait to start working with it.
Thanks for the info and you did understand my question perfectly. We really want to have a single source for our generated text content and replicating the data from the docbook l10n files to the translation.xml file is not ideal. We'll probably derive the translation.xml file from the l10n files in our build system. But just to clarify, does the translation.xml file get read once to increase performance?
BTW, the new features in 17 are great and I can't wait to start working with it.
-
- Posts: 9449
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to localize CSS generated content from Docbook l10n
Hi Steve,
There are no performance problems when using the translation.xml + i18n editor variable in CSS approach.
Indeed you could have an XSLT stylesheet which applies over the en.xml and generates the translation.xml from time to time.
http://blog.oxygenxml.com/2015/05/visua ... ts-in.html
Regards,
Radu
There are no performance problems when using the translation.xml + i18n editor variable in CSS approach.
Indeed you could have an XSLT stylesheet which applies over the en.xml and generates the translation.xml from time to time.
Great, I also blogged about the new CSS improvements (screenshots + code snippets) in Oxygen here:BTW, the new features in 17 are great and I can't wait to start working with it.
http://blog.oxygenxml.com/2015/05/visua ... ts-in.html
Regards,
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