Forum How do I...?

How to line break inside @page

Glimmerino
So I have different metadata that I want to add to the header but not on the same row. How can I insert line breaks between the strings below?

@page {
@top-left {
content: string(maptitle) " | " string(chaptertitle) " | " counter(page) " | " string(pubid);
font-size:8pt;
}


Regards!
mikeday
You can apply "white-space: pre-line" and then use \A character escapes.
Glimmerino
Thanks.

Is there anyway to individually set the properties for the content in the header. Lets say for example that I want to set the "string(maptitle)" to font-size:20;. If I do this where I collect the map title:

*[class ~= "map/map"][title] {
string-set: maptitle attr(title);
font-size: 20pt;

it doesn't affect the @page @top-left area, it only affects the actual map title.

Regards!
mikeday
Generated context text cannot be individually styled, it requires flowing an entire styled element to the page margin box using the flow property as described here.
Glimmerino
Thankyou.

I can however not get it to work.

I retrieve the map title with:

*[class ~= "map/map"][title] {
flow: static(map title);
}

Then I put it in the header with:

@page :right{
@top-right {
content: flow(map title);
}

It does however not show

Regards
mikeday
Flow identifiers cannot contain spaces.
Glimmerino
Ok, thankyou. But it still doesn't work. The pdf is generated but without content in the top-right section
mikeday
Is this a HTML document? The <title> element in HTML has "display: none" applied to it, so it will not be visible by default. Typically people make a div element in the body of the document that has the styled content that they want to include in the header or footer.

(If you just want to change the font size, then you can use regular string-set and the font-size property in the @top-right margin box. The flow mechanism is only necessary if you want to have several pieces of text in the header with different styling applied to each one).
Glimmerino
This is an xml document (DITA) containing:
<map title="some title text">
a bunch of references to other xml-docs
</map>.

I have to apply different styling to different pieces of text.
mikeday
Oh okay. You can't move attributes to the margin boxes, only entire styled elements.

It would probably be simplest to generate a fragment of HTML for this, I think it will be difficult to do purely with the XML structure that you have there.
Glimmerino
I see. Thank you very much for the help.

Regards
Kristian