associating CSS

Questions about XML that are not covered by the other forums should go here.
Posts: 28

associating CSS

Thu Jun 30, 2011 2:25 am

I have created a DITA document. Based on the properties, it seems to me that the default stylesheet is dita.css as espected. When doc is transformed (output PDF) the result is the default (white page with Title). I want to include the company’s logo on the front page. How do I do this, should I edit the existing dita.css or create a new CSS?

I tried it call the mycss.css in the ditamap file
<?xml version="1.0" encoding="UTF-8"?>
<map id="main" title="Eclipse Stereotactic Package">
<link href="mycss.css" rel="stylesheet" type="text/css" /> ---Oxygen generates an error (link element must be declared)
<topicref href="Topics/Introduction.dita">
Any help is greatly appreciated
Posts: 5927

Re: associating CSS

Thu Jun 30, 2011 11:25 am


Oxygen is just an XML Editor. The CSS files in the directory:

are used only to render the XML content for editing in the Author page. They influence in no way the publishing of DITA to various outputs like XHTML or PDF.


Oxygen comes bundled with the DITA Open Toolkit which is used to publish DITA content to various output formats.
So each time you invoke a transformation scenario Oxygen runs the bundled DITA OT (located in OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT) as an ANT process over the current DITA Map.

The DITA Open Toolkit is based on XSLT stylesheets and ANT build files which can be customized to achieve what you need.
Here is a blog entry discussing just that:

If you have problems following the steps I'll try to come up with some steps and update this post.

The DITA Users List is also a very good place to ask DITA Open Toolkit customization questions:

Radu Coravu
<oXygen/> XML Editor
Posts: 28

Re: associating CSS

Fri Jul 01, 2011 8:50 am

Many thanks Radu for the detailed explanation. It helped me to see the bigger picture now.
I tried to followed the tutorial in ... -open.html
but a section in step 3 (“..copy the createFrontMatter template into the copied XSL”) is a bit convoluted. Will try to contact the author.
Many thanks again
Posts: 5927

Re: associating CSS

Fri Jul 01, 2011 10:43 am


The blog is quite old, I'll try to give you some exact steps here:

1) Copy the entire directory:


to some other place, for example in my case to:


2) Copy your logo image to:


3) Rename the:




Open the "catalog.xml" in Oxygen and uncomment this line:

<!--uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/-->

to be like:

<uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/>

4) Rename the:



Open the "custom.xsl" in Oxygen and overwrite in it the template called createFrontMatter_1.0 from the OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/xsl/fo/front-matter.xsl like:

Code: Select all

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl=""
 <xsl:template name="createFrontMatter_1.0">
        <fo:page-sequence master-reference="front-matter" xsl:use-attribute-sets="__force__page__count">
            <xsl:call-template name="insertFrontMatterStaticContents"/>
            <fo:flow flow-name="xsl-region-body">
                <fo:block xsl:use-attribute-sets="__frontmatter">
                    <!-- set the title -->
                    <fo:block xsl:use-attribute-sets="__frontmatter__title">
                            <xsl:when test="$map/*[contains(@class,' topic/title ')][1]">
                                <xsl:apply-templates select="$map/*[contains(@class,' topic/title ')][1]"/>
                            <xsl:when test="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]">
                                <xsl:apply-templates select="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"/>
                            <xsl:when test="//*[contains(@class, ' map/map ')]/@title">
                                <xsl:value-of select="//*[contains(@class, ' map/map ')]/@title"/>
                                <xsl:value-of select="/descendant::*[contains(@class, ' topic/topic ')][1]/*[contains(@class, ' topic/title ')]"/>

                    <!-- set the subtitle -->
                    <xsl:apply-templates select="$map//*[contains(@class,' bookmap/booktitlealt ')]"/>

                    <fo:block xsl:use-attribute-sets="__frontmatter__owner">
                        <xsl:apply-templates select="$map//*[contains(@class,' bookmap/bookmeta ')]"/>
                    <fo:block text-align="center" width="100%">
                        <fo:external-graphic src="url({concat($artworkPrefix, '/Customization/OpenTopic/common/artwork/logo.png')})"/>


                <!--<xsl:call-template name="createPreface"/>-->

        <xsl:call-template name="createNotices"/>

5) Edit the DITA Map to PDF transformation action and in the Parameters tab add a new parameter called customization.dir with the value C:\Users\radu_coravu\Desktop\Customization

There are other ways in which you could directly modify the XSLs from the DITA OT but this customization gives you flexibility to future DITA OT upgrades in Oxygen.

This PDF from Scriptorium with tweaks to DITA PDF output should also be interesting to read:

Radu Coravu
<oXygen/> XML Editor
Posts: 5

Re: associating CSS

Wed Sep 17, 2014 9:22 pm

Don't believe what you read from Radu...I have asked twice how to do this...he'll give you this procedure, but, there is a README.txt in the org.dita.pdf2 that contradicts his instructions. So, SyncSoft, I'll ask again...what is the right procedure to follow? In the absence of a response, I take it they don't know....
Posts: 5927

Re: associating CSS

Thu Sep 18, 2014 8:24 am

Hi Jeff,

The discussion on this thread was in 2011 and back than Oxygen came with an older DITA Open Toolkit so my instructions on the thread may not work anymore with a newer DITA Open Toolkit.
But this topic is up to date and has been tested with the DITA Open Toolkit 1.8.4 which comes with Oxygen 16.0:

I re-checked the steps about 3-4 days ago, there are also users who follow the steps daily and they work for them.
If you follow these steps and the publishing does not work for you, just sens us an email to with a zipped version of the customization folder and we'll look into it.

Radu Coravu
<oXygen/> XML Editor

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 0 guests