Duplicate Title Names on Cover Page in PDF Output
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 21
- Joined: Wed Jun 28, 2023 11:49 pm
Duplicate Title Names on Cover Page in PDF Output
This displays the content correctly:
Content appears on the cover page as it should.
For example: Version 2023.5.0.7
This does not display any content on the cover page:
and fails with the following Oxygen message:
and it generates the output on the cover page, but the main book title appears twice as in:
Any ideas as to what I am doing wrong?
Code: Select all
*[class ~= "bookmap/booktitle"]:after(4) {
display: block;
content: oxy_xpath('if(//*[contains(@class, " bookmap/booknumber ")]) then concat(" Version ", //*[contains(@class, " bookmap/booknumber ")]/text()) else ""');
text-align: center;
color: black;
font-size: .5em;
font-style: italic;
}
For example: Version 2023.5.0.7
This does not display any content on the cover page:
Code: Select all
*[class ~= "bookmap/booktitle"]:after(3) {
display: block;
content: oxy_xpath('if(//*[contains(@class, " bookmap/mainbooktitle ")]) then concat(", Title ", //*[contains(@class, " bookmap/mainbooktitle ")]/text()) else ""');
color: red;
font-size: .5em;
}
Substituting string-join in place of concat works as in:[CH] jar:file:/C:/Program%20Files/Oxygen%20XML%20Editor%2024/lib/oxygen-pdf-chemistry.jar!/chemistry-default.css XPath "if(//*[contains(@class, " bookmap/mainbooktitle ")]) then concat(", Title ", //*[contains(@class, " bookmap/mainbooktitle ")]/text()) else """ failed: XPath failed due to: A sequence of more than one item is not allowed as the second argument of fn:concat() (text{Deployment Guide}, text{Deployment Guide})
Code: Select all
*[class ~= "bookmap/booktitle"]:after(3) {
display: block;
content: oxy_xpath('if(//*[contains(@class, " bookmap/mainbooktitle ")]) then string-join(//*[contains(@class, " bookmap/mainbooktitle ")]/text()) else ""');
color: red;
font-size: .5em;
}
This only appears to happen with anything in the book title tags. <mainbooktitle> and <booktitlealt> do the same thing. Using concat creates an error while string-join works, but the contents appear twice and are jammed together.Deployment GuideDeployment Guide
Any ideas as to what I am doing wrong?
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Duplicate Title Names on Cover Page in PDF Output
Post by chrispitude »
Hi Tinmen,
Somehow I think your XPath expression is picking up multiple <mainbooktitle> elements. If you look in the merged HTML file produced by PDF Chemistry, do you see multiple such elements?
I tried a simple testcase with your CSS and I do not get a duplicated title:
You might be able to do something like this to use only the first element:
but it would be good to understand where the extra element is coming from. Maybe there's a submap in your book or something like that.
In my suggested XPath above, note that I did not limit the path to text() nodes. This is because there could be elements that contain text within them, so I relied on XPath to evaluate the element and its descendants to text for me (which is the default behavior when evaluating an element's value).
Somehow I think your XPath expression is picking up multiple <mainbooktitle> elements. If you look in the merged HTML file produced by PDF Chemistry, do you see multiple such elements?
I tried a simple testcase with your CSS and I do not get a duplicated title:
test_bookmap_with_css.zip
You might be able to do something like this to use only the first element:
Code: Select all
oxy_xpath('if(//*[contains(@class, " bookmap/mainbooktitle ")]) then (//*[contains(@class, " bookmap/mainbooktitle ")])[1] else ""');
In my suggested XPath above, note that I did not limit the path to text() nodes. This is because there could be elements that contain text within them, so I relied on XPath to evaluate the element and its descendants to text for me (which is the default behavior when evaluating an element's value).
You do not have the required permissions to view the files attached to this post.
-
- Posts: 21
- Joined: Wed Jun 28, 2023 11:49 pm
Re: Duplicate Title Names on Cover Page in PDF Output
Thanks for taking the time to reply. I haven't evaluated the HTML output as yet since I only needed a PDF output. However, I will do so to see what happens.
I used your code snippet, and the PDF cover now renders as:
So, I updated the code line to read:
and it renders perfectly now.
Thank you!
I used your code snippet, and the PDF cover now renders as:
So no duplication as I was seeing with my code.<span class="- topic/ph bookmap/mainbooktitle ph mainbooktitle">Deployment Guide</span>
So, I updated the code line to read:
Code: Select all
oxy_xpath('if(//*[contains(@class, " bookmap/mainbooktitle ")]) then (//*[contains(@class, " bookmap/mainbooktitle ")])[1]//text() else ""');
Thank you!
Last edited by Tinmen on Thu Jun 29, 2023 9:58 pm, edited 2 times in total.
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Duplicate Title Names on Cover Page in PDF Output
Post by chrispitude »
Hi Tinmen,
I'm glad you got it working!
My reference to the merged HTML file was not to an HTML transformation, but rather to the PDF transformation you are already running. When you run a PDF Chemistry transformation, you should get a .merged.html file in the working directory as described here:
https://www.oxygenxml.com/doc/versions/ ... erged.html
This is the intermediate file that the XPath in your CSS property is operating on. You can look in this file and see if there are two <mainbooktitle> elements. Their locations should help explain why it is happening.
I'm glad you got it working!
My reference to the merged HTML file was not to an HTML transformation, but rather to the PDF transformation you are already running. When you run a PDF Chemistry transformation, you should get a .merged.html file in the working directory as described here:
https://www.oxygenxml.com/doc/versions/ ... erged.html
This is the intermediate file that the XPath in your CSS property is operating on. You can look in this file and see if there are two <mainbooktitle> elements. Their locations should help explain why it is happening.
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