re-use strings without losing formatting from the original string-set

76 Views Asked by At

I am setting a string for a chapter title using string-set.

When I add content and re-use that string through my document, I would like it to maintain the original formatting of my h1 (font-weight:bold).

How can I do that? I cannot just style the content because the rest of the content("My Document Title") should not be bold.

At the moment, I am using the string as part of a header:

 h1{
       font-weight:bold;
       string-set:chaptitle1 self;
   }

@page chap1 {       
   @top-left { 
      content: "My Document Title" string(chaptitle1) ; 
   }
}
1

There are 1 best solutions below

2
On

Maybe I don't fully understand your question but you should be able to define properties to @top-left region.

example:

    @page chap1 { 
        @top-left {
            content: "My Document Title" string(chaptitle1) ; 
            background-color: #ff0000;
            color: white;
        }
    }

This would show the background of the text red and the text white. This absolutely works in PrinceXML.