Trying out flow() in pdf-css
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 24
- Joined: Mon Aug 24, 2015 11:37 pm
Trying out flow() in pdf-css
Post by Glimmerino »
I'm currently trying out the pdf-css plugin wit the free version of prince xml. I can't however get the flow function to work. I want to put certain map metadata in the page header but I want to style the data differently. I think the right way to approach it is to use the flow () thing. But I can't get this to work. My code currently looks like:
*[class ~= "map/map"][title] {
flow: static(maptitle);
}
@page :right{
@top-right {
content: flow(maptitle);
}
@bottom-right {
/**/
}
@bottom-left {
/**/
}
}
The map title does, however, not show.
Best regards
Kristian Wennberg
*[class ~= "map/map"][title] {
flow: static(maptitle);
}
@page :right{
@top-right {
content: flow(maptitle);
}
@bottom-right {
/**/
}
@bottom-left {
/**/
}
}
The map title does, however, not show.
Best regards
Kristian Wennberg
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: Trying out flow() in pdf-css
Hello,
By using "flow", you effectively remove the element from the normal flow and you are moving it into a static part of the page. See:
http://www.princexml.com/doc/8.1/proper ... ince-flow/
http://www.princexml.com/doc/8.1/page-headers-footers/
So you are moving the entire bookmap into the top of the page (*[class ~= "map/map"][title] matches possibly the entire map), which is not ok.
I recommend generating a new XML element that contains the title that can be moved to the page header. In the stylesheet:
frameworks/dita/DITA-OT/plugins/com.oxygenxml.pdf.css/post-process.xsl
You should modify the template that generates the <oxy:front-page> element and generate another element before it, let's name it <oxy:title-to-move-to-headers>. This contains the book title text:
Then modify the CSS:
frameworks\dita\css\print\p-page-titles-and-numbers.css to have this content:
Please note that there are similar files in the DITA-OT installations, but these are used only when running the DITA-OT transformations from the command line, not from oXygen.
frameworks\dita\DITA-OT\plugins\com.oxygenxml.pdf.css\css\print\p-page-titles-and-numbers.css
frameworks\dita\DITA-OT2x\plugins\com.oxygenxml.pdf.css\css\print\p-page-titles-and-numbers.css
As a general rule, when testing CSS extensions, try with very small documents, not necessarily related to DITA.
Cheers,
Dan
By using "flow", you effectively remove the element from the normal flow and you are moving it into a static part of the page. See:
http://www.princexml.com/doc/8.1/proper ... ince-flow/
http://www.princexml.com/doc/8.1/page-headers-footers/
So you are moving the entire bookmap into the top of the page (*[class ~= "map/map"][title] matches possibly the entire map), which is not ok.
I recommend generating a new XML element that contains the title that can be moved to the page header. In the stylesheet:
frameworks/dita/DITA-OT/plugins/com.oxygenxml.pdf.css/post-process.xsl
You should modify the template that generates the <oxy:front-page> element and generate another element before it, let's name it <oxy:title-to-move-to-headers>. This contains the book title text:
Code: Select all
<!--
Create a title page
-->
<xsl:template match="*[contains(@class, ' map/map ')]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<!-- INSERT THIS -->
<oxy:title-to-move-to-headers>
<xsl:choose>
<xsl:when test="@title">
<xsl:value-of select="@title"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates
select="opentopic:map/*[contains(@class, ' topic/title ')]"/>
</xsl:otherwise>
</xsl:choose>
</oxy:title-to-move-to-headers>
<!-- END INSERT -->
<oxy:front-page>
<oxy:front-page-title>
<xsl:choose>
frameworks\dita\css\print\p-page-titles-and-numbers.css to have this content:
Code: Select all
@media print {
title-to-move-to-headers {
flow: static(th);
}
@page :left {
@top-left {
content:flow(th);
}
}
@page :right{
@top-right {
content:flow(th);
}
}
}
frameworks\dita\DITA-OT\plugins\com.oxygenxml.pdf.css\css\print\p-page-titles-and-numbers.css
frameworks\dita\DITA-OT2x\plugins\com.oxygenxml.pdf.css\css\print\p-page-titles-and-numbers.css
As a general rule, when testing CSS extensions, try with very small documents, not necessarily related to DITA.
Cheers,
Dan
-
- Posts: 24
- Joined: Mon Aug 24, 2015 11:37 pm
Re: Trying out flow() in pdf-css
Post by Glimmerino »
Thank you Dan for making things clearer. There are however two issues that I still struggle with.
The code you suggested adds a blank first page. How do I get rid of it without loosing the "title to move to headers variable"?
Even though the flow-thing now works it does not solve my core problem and that is that I want to style content differently in the same @page region. For example my company header consist of two line of text: "Company Classification" and directly beneath this line is the actual classification (could be RESTRICTED/CLASSIFIED/OPEN). These two text lines shall have different font size. Thats the reason for the individual formatting.
I guess "Company Classification " could be defined as an xsl-variable with static content. And then flowed just like the earlier example. However, it looks like its not possible to flow different elements to the same page-region.
Regards
Kristian
The code you suggested adds a blank first page. How do I get rid of it without loosing the "title to move to headers variable"?
Even though the flow-thing now works it does not solve my core problem and that is that I want to style content differently in the same @page region. For example my company header consist of two line of text: "Company Classification" and directly beneath this line is the actual classification (could be RESTRICTED/CLASSIFIED/OPEN). These two text lines shall have different font size. Thats the reason for the individual formatting.
I guess "Company Classification " could be defined as an xsl-variable with static content. And then flowed just like the earlier example. However, it looks like its not possible to flow different elements to the same page-region.
Regards
Kristian
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: Trying out flow() in pdf-css
Hello Kristian,
1. For the first problem, move the <oxy:title-to-move-to-headers> inside <oxy:front-page-title>.
2. For the second problem, regarding styling differently parts of the header, why don't you generate from XSLT a more complex content for the <oxy:title-to-move-to-headers>, and then style each of the elements individually from CSS?
Cheers,
Dan
1. For the first problem, move the <oxy:title-to-move-to-headers> inside <oxy:front-page-title>.
Code: Select all
<xsl:template match="*[contains(@class, ' map/map ')]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<oxy:front-page>
<oxy:front-page-title>
<xsl:choose>
<xsl:when test="@title">
<xsl:value-of select="@title"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates
select="opentopic:map/*[contains(@class, ' topic/title ')]"/>
</xsl:otherwise>
</xsl:choose>
<oxy:title-to-move-to-headers>
<xsl:choose>
<xsl:when test="@title">
<xsl:value-of select="@title"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates
select="opentopic:map/*[contains(@class, ' topic/title ')]"/>
</xsl:otherwise>
</xsl:choose>
</oxy:title-to-move-to-headers>
</oxy:front-page-title>
</oxy:front-page>
..............
Cheers,
Dan
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service