associating CSS

Questions about XML that are not covered by the other forums should go here.
ditatizer
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
:oops:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "http://docs.oasis-open.org/dita/v1.1/OS/dtd/map.dtd">
<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">
……
……
</map>
Any help is greatly appreciated
Radu
Posts: 5563

Re: associating CSS

Thu Jun 30, 2011 11:25 am

Hi,

Oxygen is just an XML Editor. The CSS files in the directory:
OXYGEN_INSTALL_DIR/frameworks/dita/css_classed

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.

But:

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:
http://wrycan.blogspot.com/2009/02/how-to-modify-cover-page-in-dita-open.html

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:
http://tech.groups.yahoo.com/group/dita-users/

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
ditatizer
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
http://wrycan.blogspot.com/2009/02/how- ... -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
Radu
Posts: 5563

Re: associating CSS

Fri Jul 01, 2011 10:43 am

Hi,

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

1) Copy the entire directory:

OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/Customization

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

C:\Users\radu_coravu\Desktop\Customization

2) Copy your logo image to:

C:\Users\radu_coravu\Desktop\Customization\common\artwork\logo.png

3) Rename the:

C:\Users\radu_coravu\Desktop\Customization\catalog.xml.orig

to:

C:\Users\radu_coravu\Desktop\Customization\catalog.xml

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:
C:\Users\radu_coravu\Desktop\Customization\fo\xsl\custom.xsl.orig

to:

C:\Users\radu_coravu\Desktop\Customization\fo\xsl\custom.xsl

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="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version="1.1">
 <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:choose>
                            <xsl:when test="$map/*[contains(@class,' topic/title ')][1]">
                                <xsl:apply-templates select="$map/*[contains(@class,' topic/title ')][1]"/>
                            </xsl:when>
                            <xsl:when test="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]">
                                <xsl:apply-templates select="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"/>
                            </xsl:when>
                            <xsl:when test="//*[contains(@class, ' map/map ')]/@title">
                                <xsl:value-of select="//*[contains(@class, ' map/map ')]/@title"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="/descendant::*[contains(@class, ' topic/topic ')][1]/*[contains(@class, ' topic/title ')]"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </fo:block>

                    <!-- 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>
                   
                    <fo:block text-align="center" width="100%">
                        <fo:external-graphic src="url({concat($artworkPrefix, '/Customization/OpenTopic/common/artwork/logo.png')})"/>
                     </fo:block>

                </fo:block>

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

            </fo:flow>
        </fo:page-sequence>
        <xsl:call-template name="createNotices"/>
    </xsl:template>
</xsl:stylesheet>


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:

http://www.scriptorium.com/whitepapers/ditaotpdf/DITA-PDF-tweaks.pdf

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
JeffHendricks
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....
Radu
Posts: 5563

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:

http://www.oxygenxml.com/doc/ug-oxygen/#topics/dita_pdf_output_customization.html

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 support@oxygenxml.com with a zipped version of the customization folder and we'll look into it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest