oxy_* functions and maptitle variable not working in CSS @page scope?
Post here questions and problems related to editing and publishing DITA content.
-
Vinny
- Posts: 30
- Joined: Wed Jan 12, 2022 1:07 pm
oxy_* functions and maptitle variable not working in CSS @page scope?
Folks,
I’m trying to split the ‘Title’ of a document to have it printed on two lines in the footer (PDF/CSS transform). For example, my title could be ‘Sample Document $ Rev. 1' and in the footer I'd like to have 'Sample Document' printed above 'Rev. 1', using '$' as a separator for the two lines.
So I set out writing a first CSS draft rule like this:
This would of course display only the first part, but, the result is stubbornly void. This doesn’t return anything, although the ‘maptitle’ variable is correctly set, since:
works perfectly well.
Also, this code:
displays '-1' in the footer, as if the string was empty or not defined. I've tried other characters instead of '$', to no avail.
However,
Correctly outputs 3. So something is wrong, as if maptitle wasn't set when the CSS rule is evaluated.
Any clue to what I did wrong or workaround?
EDIT: This works fine, is maybe simpler?
I’m trying to split the ‘Title’ of a document to have it printed on two lines in the footer (PDF/CSS transform). For example, my title could be ‘Sample Document $ Rev. 1' and in the footer I'd like to have 'Sample Document' printed above 'Rev. 1', using '$' as a separator for the two lines.
So I set out writing a first CSS draft rule like this:
Code: Select all
@page :right {
[…]
@bottom-right {
content: oxy_substring(string(maptitle), 0, oxy_indexof(string(maptitle), "$"));
}
}
Code: Select all
content: string(maptitle);
Also, this code:
Code: Select all
content: oxy_indexof(string(maptitle),"$");
However,
Code: Select all
content: oxy_indexof("abc@abc", "@");
Any clue to what I did wrong or workaround?
EDIT: This works fine, is maybe simpler?
Code: Select all
content: oxy_xpath('substring-before(//head/title/text(), "|")')
"\0A"
oxy_xpath('substring-after(//head/title/text(), "|")');
-
julien_lacour
- Posts: 742
- Joined: Wed Oct 16, 2019 3:47 pm
Re: oxy_* functions and maptitle variable not working in CSS @page scope?
Post by julien_lacour »
Hello,
The issue is that string() CSS function is evaluated per page for margin boxes, so its value is only available at page generation time and cannot be used as a parameter in an oxy function.
Instead you could use oxy_xpath() and create a new string-set (keep the original maptitle or it will be overriden by the custom definition):
Regards,
Julien
The issue is that string() CSS function is evaluated per page for margin boxes, so its value is only available at page generation time and cannot be used as a parameter in an oxy function.
Instead you could use oxy_xpath() and create a new string-set (keep the original maptitle or it will be overriden by the custom definition):
Code: Select all
*[class ~= "front-page/front-page-title"] > *[class ~= "topic/title"] {
string-set: maptitle content(),
custommaptitle oxy_xpath("if (contains(text(), '$')) then replace(text(), '\\$', '\0A') else text()");
}
@page :right {
@bottom-right {
content: string(custommaptitle);
}
}
Julien
Return to “DITA (Editing and Publishing DITA Content)”
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