Website Deliverables - webworks.com Previous Next Index Print
Disabling External CSS files

Disabling External CSS files

Last Modified: October 9, 2006

ePublisher Pro

The purpose of this article is to explain how to disable external CSS files from being generated.

For each document in your ePublisher Pro project, an external CSS file is created. The number of files in the project and the amount of style information in each document determines the size of these CSS files; they can become very large and redundant. Often, custom CSS files are used to get around this; however, ePublisher Pro will still emit the external CSS files. Often users will just delete the unused CSS files but this can be problematic if they are deploying straight to a web server.

We will look at how to modify pages.fti and styles.xsl files to allow users to choose whether or not they want to emit the external CSS files. You will need to be familiar with how to perform a project target override. For more information on how to perform a project target override, please see “Creating Project Target Overrides”.

Modifying pages.fti

Modifying the pages.fti file allows users to place an option setting in the UI that will allow users to enable or disable CSS file generation.

*

By default pages.fti is located in C:\Program Files\WebWorks\ePublisher Pro\For­mats\[FORMAT]\Transforms where [FORMAT] is the format from which the target you are converting is based.

2)

Open pages.fti and find the <Groups> tag. Add the following:

<Group name="css" />

So the modified section would look like this:

<Groups>

<Group name="css" />

<Group name="files" />

<Group name="toc" />

<Group name="accessibility" />

<Group name="pdf" />

<Group name="options" />

<Group name="navigation" />

</Groups>

3)

Under the <Settings> tag add the following:

<!-- Emit external CSS -->

<!-- -->

<Setting name="emit-external-css" group="css" default="true">

<SettingClass name="boolean" />

</Setting>

So the modified section would look like this:

<Settings>

<!-- Emit external CSS -->

<!-- -->

<Setting name="Emit External CSS" group="CSS" default="true">

<SettingClass name="boolean" />

</Setting>

<!-- Encoding -->

<!-- -->

Modifying styles.xsl

Modifying the code in styles.xsl will check the option setting from the pages.fti file and will determine based on the setting whether or not to emit the CSS files.

*

By default styles.xsl is located in C:\Program Files\WebWorks\ePublisher Pro\For­mats\[FORMAT]\Transforms where [FORMAT] is the format from which the target you are converting is based.

2)

Open styles.xsl and find the <wwfiles:Files version="1.0"> tag. Add the following:

<xsl:if test="wwprojext:GetFormatSetting('emit-external-css', 'false') = 'true'">

So the modified section would look like this:

<wwfiles:Files version="1.0">

<xsl:if test="wwprojext:GetFormatSetting('emit-external-css', 'false') = 'true'">

<!-- Groups -->

<!-- -->

3)

Under the <xsl:variable name="VarProgressProjectGroupsEnd" select="wwprogress:End()" /> tag add the following:

</xsl:if>

So the modified section would look like this:

<xsl:variable name="VarProgressProjectGroupEnd" select="wwprogress:End()" />

</xsl:for-each>

<xsl:variable name="VarProgressProjectGroupsEnd" select="wwprogress:End()" />

</xsl:if>

</wwfiles:Files>

</xsl:template>

Format Settings