Header / Footer equivalents from FO

Having trouble installing Oxygen PDF Chemistry? Got a bug to report? Post it all here.
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Header / Footer equivalents from FO

Post by shudson310 »

How do I configure Chemistry to handle alternating page headers/footers?

For example, in our FO customization we have:

Code: Select all

<xsl:template name="insertBodyOddFooter">
<fo:static-content flow-name="odd-body-footer">
<fo:block xsl:use-attribute-sets="__body__odd__footer">
<fo:table width="100%">
<fo:table-column column-number="1"
column-width="40%" />
<fo:table-column column-number="2"
column-width="20%" />
<fo:table-column column-number="3"
column-width="40%" />
<fo:table-body>
<fo:table-row><xsl:attribute name="height">9pt</xsl:attribute>
<fo:table-cell margin-left="0pt" margin-right="0pt" margin-top="0pt">
<fo:block text-align="start"><xsl:value-of select="$Copyright"/></fo:block>
<fo:block text-align="start"><xsl:value-of select="$Permission"/></fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0pt" margin-top="0pt" margin-right="0pt">
<fo:block text-align="center"></fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0pt" margin-top="0pt" margin-right="0pt">
<fo:block text-align="end"><xsl:value-of select="$mainBookTitle"/></fo:block>
<fo:block text-align="end" font-weight="bold"><fo:page-number/></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:static-content>
</xsl:template>

<xsl:template name="insertBodyEvenFooter">
<fo:static-content flow-name="even-body-footer">
<fo:block xsl:use-attribute-sets="__body__even__footer">
<fo:table width="100%">
<fo:table-column column-number="1"
column-width="40%" />
<fo:table-column column-number="2"
column-width="20%" />
<fo:table-column column-number="3"
column-width="40%" />
<fo:table-body>
<fo:table-row><xsl:attribute name="height">9pt</xsl:attribute>
<fo:table-cell margin-left="0pt" margin-right="0pt" margin-top="0pt">
<fo:block text-align="start"><xsl:value-of select="$mainBookTitle"/></fo:block>
<fo:block text-align="start" font-weight="bold"><fo:page-number/></fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0pt" margin-top="0pt" margin-right="0pt">
<fo:block text-align="center"></fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0pt" margin-top="0pt" margin-right="0pt">
<fo:block text-align="left"><xsl:value-of select="$Copyright"/></fo:block>
<fo:block text-align="left"><xsl:value-of select="$Permission"/></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:static-content>
</xsl:template>
How do I achieve the same functionality in Chemistry CSS?
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: Header / Footer equivalents from FO

Post by shudson310 »

Think I found what I needed in the doc:
https://www.oxygenxml.com/doc/versions/ ... nd-footers

Thanks,

--Scott
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: Header / Footer equivalents from FO

Post by shudson310 »

OK, still need some help. I've tried to declare all of the variables I need using:
[Codebox=] :root {
font-family: 'Helvetica Neue', sans-serif;
font-size:10pt;
string-set: prodname oxy_xpath("//bookmeta//prodinfo/prodname");
string-set: prodversion oxy_xpath("//bookmeta//prodinfo/vrmlist/vrm/@version") "." oxy_xpath("//bookmeta//prodinfo/vrmlist/vrm/@release") "." oxy_xpath("//bookmeta//prodinfo/vrmlist/vrm/@modification");
string-set: category oxy_xpath("//bookmeta//category[last()]");
string-set: creationdate oxy_xpath("//bookmeta//created/@date[1]");
string-set: copyrfirst oxy_xpath("//bookmeta/bookrights/copyrfirst/year");
string-set: copyrlast oxy_xpath("//bookmeta/bookrights/copyrlast/year");
string-set: companyname oxy_xpath("//bookmeta/bookrights/bookowner/organization");
string-set: bookrights oxy_xpath("//bookmeta/bookrights/summary");
string-set: permission oxy_xpath("//bookmeta/permissions/@view");
}

h1 {
page-break-before:always;
text-align: center;
font-size:larger;
string-set: chapter_title content();
}[/Codebox]

Then I try to use them in my header/footer:
[Codebox=]@page :left {
@top-left {
content : string(chapter_title) !important;
}
@top-right { image-resolution: 300dpi;
max-width: 0.5in;
content:url('../../images/logo.print.png') !important;
}

@bottom-left {
content : "\00a9" string(copyrlast) string(companyname) string(bookrights) "\a" string(permission) !important;
}
@bottom-right {
content : string(prodname) string(prodversion) string(category) " | " counter(page) !important;
}
}[/Codebox]

In my output, I only get the page number and the copyright symbol, so the variables are not resolving. What am I missing?
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Header / Footer equivalents from FO

Post by Dan »

Hello Scott,

To define multiple string sets for an element, please use a single string-set property with a list of comma separated definitions:

Code: Select all


:root {
string-set: prodname oxy_xpath("//bookmeta//prodinfo/prodname"), prodversion oxy_xpath("//bookmeta//prodinfo/vrmlist/vrm/@version") "." oxy_xpath("//bookmeta//prodinfo/vrmlist/vrm/@release") "." oxy_xpath("//bookmeta//prodinfo/vrmlist/vrm/@modification"), category oxy_xpath("//bookmeta//category[last()]"), .....
}
otherwise, the string-set properties are overwritten by the last one.

Best regards,
Dan
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: Header / Footer equivalents from FO

Post by shudson310 »

The comma separation still doesn't appear to be working. Is the oxy_xpath based off of the original bookmap, or based on the merged.html or other?

I now have:

Code: Select all

:root {
font-family: 'Helvetica Neue', sans-serif;
font-size:10pt;
string-set: prodname oxy_xpath("//prodinfo/prodname"), prodversion oxy_xpath("//prodinfo/vrmlist/vrm/@version"), prodrelease oxy_xpath("//prodinfo/vrmlist/vrm/@release"), prodmod oxy_xpath("//prodinfo/vrmlist/vrm/@modification"), category oxy_xpath("//category[last()]"), creationdate oxy_xpath("//created/@date[1]"), copyrfirst oxy_xpath("//bookrights/copyrfirst/year"), copyrlast oxy_xpath("//bookrights/copyrlast/year"), companyname oxy_xpath("//bookrights/bookowner/organization"), bookrights oxy_xpath("//bookrights/summary"), permission oxy_xpath("//permissions/@view");
}
But still not getting values in my headers or footers:

Code: Select all

  @bottom-right {
content : string(prodname) string(prodversion) string(category) " | " counter(page) !important;
}
All I get in the output is the pipe symbol and the page number.
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: Header / Footer equivalents from FO

Post by Costin »

The XPath expressions should be modified to matche the HTML div elements, by using the class attributes.
For clarity:

Code: Select all


:root {
font-family: 'Helvetica Neue', sans-serif;
font-size:10pt;
string-set:
prodname oxy_xpath("(//*[contains(@class, 'topic/prodname')]/text())[1]"),
prodversion oxy_xpath("(//*[contains(@class, 'topic/vrm')]/@version)[1]"),
prodrelease oxy_xpath("(//*[contains(@class, 'topic/vrm')]/@release)[1]"),
prodmod oxy_xpath("(//*[contains(@class, 'topic/vrm')]/@modification)[1]"),
category oxy_xpath("(//*[contains(@class, 'topic/category')][last()]/text())[1]"),
creationdate oxy_xpath("(//*[contains(@class, 'bookmap/created')]/@date)[1]"),
copyrfirst oxy_xpath("(//*[contains(@class, 'bookmap/copyrfirst')]/*[contains(@class, 'bookmap/year')]/text())[1]"),
copyrfirst oxy_xpath("(//*[contains(@class, 'bookmap/copyrlast')]/*[contains(@class, 'bookmap/year')]/text())[1]"),

companyname oxy_xpath("(//*[contains(@class, 'bookmap/bookowner')]/*[contains(@class, 'bookmap/organization')]/text())[1]"),
bookrights oxy_xpath("(//*[contains(@class, 'bookmap/bookrights')]/*[contains(@class, 'bookmap/summary')]/text())[1]"),
permission oxy_xpath("(//*[contains(@class, 'bookmap/permissions')]/@view)[1]");

}
We sent you a private email with the complete modified CSS.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: Header / Footer equivalents from FO

Post by shudson310 »

Thanks for your help! I'm able to produce the headers and footers I need now.
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Post Reply