The first page of document (not frontmatter) - different background
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 26
- Joined: Wed Nov 27, 2019 11:03 am
The first page of document (not frontmatter) - different background
Hi again.
Please tell me how to provide the first page of the first chapter with it's own background image.
Is there some named page for this case?
I tried
but it works exactly like .
Please tell me how to provide the first page of the first chapter with it's own background image.
Is there some named page for this case?
I tried
Code: Select all
@page :first {
background-image: url(page_background.svg);
}
Code: Select all
"@page chapter:first"
-
- Posts: 846
- Joined: Mon Dec 05, 2011 6:04 pm
Re: The first page of document (not frontmatter) - different background
Hello,
There is no dedicated named-page for the first page of the first chapter, but you could create a named-page of your own for this use-case.
More specific, you could set an "outputclass" attribute on the 1st chapter in your DITA Map / Bookmap, then match it through a CSS selector in your customization CSS and set a dedicated page style for it. Then, you should just select the very first page in the page sequence.
Let's say in your Map, you set, then in your customization CSS use:
Best Regards,
Costin
There is no dedicated named-page for the first page of the first chapter, but you could create a named-page of your own for this use-case.
More specific, you could set an "outputclass" attribute on the 1st chapter in your DITA Map / Bookmap, then match it through a CSS selector in your customization CSS and set a dedicated page style for it. Then, you should just select the very first page in the page sequence.
Let's say in your Map, you set
Code: Select all
outputclass="firstChapter"
Code: Select all
[class~="map/map"] > [class~="firstChapter"]{
page: firstPage-firstChapter;
border: 1px solid red;
}
@page firstPage-firstChapter:first {
background-image: url("page_background.svg");
}
Costin
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
-
- Posts: 26
- Joined: Wed Nov 27, 2019 11:03 am
Re: The first page of document (not frontmatter) - different background
Hi Costin!
Thanks a lot! It works.
But works for chapter after TOC only. What should I modify to apply this solution to chapter with outputclass="before-toc"?
(I don't know how to combine two or more "outputclass". I found the 'before-toc' string in XSL file only.)
Sincerely,
Dmitry
Thanks a lot! It works.
But works for chapter after TOC only. What should I modify to apply this solution to chapter with outputclass="before-toc"?
(I don't know how to combine two or more "outputclass". I found the 'before-toc' string in XSL file only.)
Sincerely,
Dmitry
-
- Posts: 846
- Joined: Mon Dec 05, 2011 6:04 pm
Re: The first page of document (not frontmatter) - different background
Hi Dmitry,
It is possible to set multiple values for an attribute, separating the values with the whitespace character.
In your case, you could have multiple outputclass values, like:
Regards,
Costin
It is possible to set multiple values for an attribute, separating the values with the whitespace character.
In your case, you could have multiple outputclass values, like:
Code: Select all
outputclass="firstChapter before-toc"
Costin
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
-
- Posts: 26
- Joined: Wed Nov 27, 2019 11:03 am
Re: The first page of document (not frontmatter) - different background
Hi Costin!
Unfortunately, they don't work together. The topic marked with outputclass="firstChapter before-toc" is before the table of contents, has its own background, but still has a number, despite the
Sincerely,
Dmitry
Unfortunately, they don't work together. The topic marked with outputclass="firstChapter before-toc" is before the table of contents, has its own background, but still has a number, despite the
Code: Select all
*[class ~= "map/map"][numbering ^= 'deep'] *[class ~= "map/topicref"][outputclass = "before-toc"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"]:before {
content: none;
}
Dmitry
-
- Posts: 846
- Joined: Mon Dec 05, 2011 6:04 pm
Re: The first page of document (not frontmatter) - different background
Hi Dmitry,
Actually they do work together, otherwise you either wouldn't have the page displayed before the Table Of Contents or wouldn't have the specific background set only for that first page.
It is only the selector you are trying to use is not the correct one.
More specific, among other default CSS files that oXygen comes predefined with, there is a "p-pages-and-headers.css" in Oxygen21_install_dir\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.pdf.css\css\print folder which determines the default content for various named-pages, like the default page, toc page, frontpage, etc.
If you open that CSS document, you should see there are some rulesets that establish "default page layout":
This is the CSS part that styles the page with the chapter title and page number.
So you could just overwrite it in your customization CSS, through a similar rule, based on the custom named-page you created previously ("firstPage-firstChapter") like that:
Regards,
Costin
Actually they do work together, otherwise you either wouldn't have the page displayed before the Table Of Contents or wouldn't have the specific background set only for that first page.
It is only the selector you are trying to use is not the correct one.
More specific, among other default CSS files that oXygen comes predefined with, there is a "p-pages-and-headers.css" in Oxygen21_install_dir\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.pdf.css\css\print folder which determines the default content for various named-pages, like the default page, toc page, frontpage, etc.
If you open that CSS document, you should see there are some rulesets that establish "default page layout":
Code: Select all
@page :left {
@top-left {
content: string(maptitle) string(parttitle) string(chaptertitle) string(sectiontitle) " | " counter(page);
}
}
@page :right{
@top-right {
content: string(maptitle) string(parttitle) string(chaptertitle) string(sectiontitle) " | " counter(page);
}
}
So you could just overwrite it in your customization CSS, through a similar rule, based on the custom named-page you created previously ("firstPage-firstChapter") like that:
Code: Select all
@page firstPage-firstChapter:left:right {
@top-left {
content: none;
}
}
Costin
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
-
- Posts: 26
- Joined: Wed Nov 27, 2019 11:03 am
Re: The first page of document (not frontmatter) - different background
Hi Costin!
I should have been more precise. I need the title on this page to have no number, not a page. Selector in my CSS is about it.
Sincerely,
Dmitry
I should have been more precise. I need the title on this page to have no number, not a page. Selector in my CSS is about it.
Sincerely,
Dmitry
-
- Posts: 846
- Joined: Mon Dec 05, 2011 6:04 pm
Re: The first page of document (not frontmatter) - different background
Hi Dmitry,
In this case, you could use another selector that matches the number before the chapter title.
In such cases, when you need to debug your CSS customization, you should use your internet browser's inspector to analyze the intermediary merged.html file and identify the rules that are applied on specific elements, so you could then override those specific selectors in your customization CSS. Please see more details on this technique in the Debugging the CSS section from the DCCP User-Guide.
In your specific case, there is a CSS rule coming from a default CSS that comes with oXygen (p-i18n-en.css) and which looks like:
that you should override in your customization CSS, like:
Regards,
Costin
In this case, you could use another selector that matches the number before the chapter title.
In such cases, when you need to debug your CSS customization, you should use your internet browser's inspector to analyze the intermediary merged.html file and identify the rules that are applied on specific elements, so you could then override those specific selectors in your customization CSS. Please see more details on this technique in the Debugging the CSS section from the DCCP User-Guide.
In your specific case, there is a CSS rule coming from a default CSS that comes with oXygen (p-i18n-en.css) and which looks like:
Code: Select all
[class~="topic/topic"][is-chapter]:not([is-part]) > [class~="topic/title"]::before {
content: "Chapter " counter(chapter) ". ";
}
Code: Select all
*[class~="before-toc"][is-chapter]:not([is-part]) > [class~="topic/title"]::before{
content: none !important;
}
Costin
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
-
- Posts: 846
- Joined: Mon Dec 05, 2011 6:04 pm
Re: The first page of document (not frontmatter) - different background
Indeed, it is not possible to remove the number in the TOC, in the version 21.
I've already logged this in our internal issue tracking system so our development team will implement an improvement in the next version of oXygen.
If that's urgent and if you are interested to test the latest version of an internal nightly build, just let us know on support@oxygenxml.com.
Regards,
Costin
I've already logged this in our internal issue tracking system so our development team will implement an improvement in the next version of oXygen.
If that's urgent and if you are interested to test the latest version of an internal nightly build, just let us know on support@oxygenxml.com.
Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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