Add topic file path to footer in PDF > CSS
Post here questions and problems related to editing and publishing DITA content.
Add topic file path to footer in PDF > CSS
Hi,
Is there an easy way to add the file path of a topic as a footer in the PDF > HTML/CSS transformation? When we are reviewing a PDF, it would be great to see which file is the source of a topic in the PDF. For example:
My Troubleshooting Topic
Some content
Footer: troubleshooting\my_troubleshooting_topic.dita
Is there an easy way to add the file path of a topic as a footer in the PDF > HTML/CSS transformation? When we are reviewing a PDF, it would be great to see which file is the source of a topic in the PDF. For example:
My Troubleshooting Topic
Some content
Footer: troubleshooting\my_troubleshooting_topic.dita
Adam Myers
Technical Publications Manager
MATRIXX Software
Technical Publications Manager
MATRIXX Software
Re: Add topic file path to footer in PDF > CSS
Not quite easy, but possible:
1. If you do not have yet a publishing template in place, you can start by creating a publishing template stub, that you will use in your transformation scenario. For this, go to the https://styles.oxygenxml.com and press the 'Download' buton. Save the 'styles.zip' archive in your project, then extract it in the 'styles' foolder. You can read more about the publishing templates here: https://www.oxygenxml.com/doc/ug-pdf-cs ... plate.html
2. Add a XSLT extension point that will copy location information in the XML intermediate formats (there is a publishing pipeline, we need to push this information through it). For this create a new folder 'styles/xsl'. Create a file named 'merged2mergedExtension.xsl' with the following content:
3. Create a new CSS file that uses the 'topic-uri' attribute and place it into the bottom left of the pages. Name this file 'custom.css' and place it next to the 'styles/styles.opt' file.
4. Refer these two files from the styles.opt publishing template descriptor.
5. Next, configure your transformation scenario to use this publishing template. See: https://www.oxygenxml.com/doc/ug-pdf-cs ... plate.html
You can use this example as a starting point to change your publishing template.
Let us know if you need more information.
Many regards,
Dan
1. If you do not have yet a publishing template in place, you can start by creating a publishing template stub, that you will use in your transformation scenario. For this, go to the https://styles.oxygenxml.com and press the 'Download' buton. Save the 'styles.zip' archive in your project, then extract it in the 'styles' foolder. You can read more about the publishing templates here: https://www.oxygenxml.com/doc/ug-pdf-cs ... plate.html
2. Add a XSLT extension point that will copy location information in the XML intermediate formats (there is a publishing pipeline, we need to push this information through it). For this create a new folder 'styles/xsl'. Create a file named 'merged2mergedExtension.xsl' with the following content:
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dita2html="http://dita-ot.sourceforge.net/ns/200801/dita2html"
exclude-result-prefixes="xs dita2html" version="2.0">
<xsl:template match="@xtrf" priority="100">
<xsl:attribute name="topic-uri" select="."/>
</xsl:template>
</xsl:stylesheet>
Code: Select all
*[class~='topic/body'] {
string-set: topic-uri-string attr(topic-uri);
}
@page chapter {
@bottom-left {
content: "Location: " string(topic-uri-string);
}
}
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<publishing-template>
<name>Custom Template</name>
<webhelp>
<preview-image file="preview/generated-preview.png"/>
<resources>
<css file="styles.css"/>
<fileset>
<include name="resources/**/*"/>
<include name="*.css"/>
<include name="css/**/*"/>
</fileset>
</resources>
<parameters>
<parameter name="webhelp.show.main.page.tiles" value="yes"/>
<parameter name="webhelp.show.main.page.toc" value="no"/>
</parameters>
</webhelp>
<pdf>
<preview-image file="preview/generated-preview.png"/>
<resources>
<css file="styles.css"/>
<!-- reference -->
<css file="custom.css"/>
</resources>
<!-- reference -->
<xslt>
<extension
id="com.oxygenxml.pdf.css.xsl.merged2merged"
file="xslt/merged2mergedExtension.xsl"/>
</xslt>
</pdf>
</publishing-template>
You can use this example as a starting point to change your publishing template.
Let us know if you need more information.
Many regards,
Dan
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