oxy_* functions and maptitle variable not working in CSS @page scope?
Posted: Tue Nov 25, 2025 6:13 pm
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(), "|")');