Change value of field in page header dynamically based on value on page

Hi,
I’m developing PDF output from LibreOffice programmatically (DITA-OT plugin). I have a background in FO and CSS2Print and am trying to basically setup a marker that updates a field in the page header. Been trying to do this in an Writer document via the gui to see what is necessary to get this to happen.

This is not a chapter title but a chapter number that is not sequential but user defined in a diatmap. If I have three chapters, the chapter numbering can be 3, 9, 6 (this would be the order it would appear in the output).

Any insight how to do this via the gui would be appreciated.

Mario

Please give a better specification of what you want to achieve. What does “user defined in a diatmap” mean? (particularly “diatmap”)
If it boils down to capturing a chapter number, it is very easy. The only specific part is to force a non-sequential chapter number. I can give you the recipe, but I need to know exactly what you expect.

The ditamap is the input XML for the DITA-OT plugin. I’m using XSLT to create the content.xml, meta.xml, and styles.xml. The number to use in the page header is extracted from the ditamap for each chapter.

I don’t know how you generate the Writer document, but you must synthesise one in such a way that your chapter headings have style Heading n (n= the required level from 1 to 10). The header will reference the chapter number at level n.

For non-sequential numbering, you must insert the equivalent of a direct formatting command on your chapter headings from Format>Paragraph, Outline & List tab where you tick both Restart numbering at this paragraph and Start with (and you enter the desired chapter number).

This is what I’d do manually. Since I never wrote a macro (because I never needed one up to now), I let you find how to translate this either with XSLT or a macro.

Thanks for your reply. I’m guessing there is no concept of marker in LibreOffice like in FO.

What is your definition of “marker”? This could translate into bookmark or reference.

A marker is not a bookmark. It could be a reference in LibreOffice.

A marker is a variable that can be changed dynamically. So I set a reference to a marker with name Mark01 in the page header. Then in the content there can be content that gives Mark01 its content/value to display. There can be multiple content on a page that gives Mark01 its content/value. Rules define which to use.

What I was hoping is that there is a way to do this manually in the gui that I can reverse engineer and recreate it programmatically.

Bookmarks and references are quite the same concept. They differ in the way they are used. But they are not dynamic. They designate a location or a sequence in the document and this can’t be changed (unless you delete it and recreate it somewhere else).

Variables keep their value up to the next definition. In other words, a variable has a current value depending on the position in the document where you use the variable.

Variables and references are different objects. You can’t assign a reference to a variable.

If you need to insert some content (page number, chapter heading, chapter number, …) dependent on the current position, you must use fields. Most of the fields close to what you describe are in the Document tab of Insert>Field>More Fields. Unfortunately, you can’t define custom “location-sensitive” fields. You are constrained to built-in ones.

Give a concrete example of your Mark01 marker and how you use it. Don’t describe a “solution”, just what you mark and how you intend to use it.