Using WinGrep utility to Customize DITA -OT

Using WinGrep utility to Customize DITA -OT

DITA open tool kit is one of the best tool for single sourcing documentation. We have already prepared custom pdf plugin. I would like to share one of the very helpful tool that may help you quickly customise pdf plugin.

For example, Lets change our custom pdf plugin in such a way that it should be able to generate pdf output with combination of two column as well as single column structure. As you know, the structure of DITA open toolkit’s pdf plugin is as follows

wingrep01

Since, we want to change the layout of pages in output we need to customise layout-master.xsl.

File to be copied From To
layout-master.xsl DITA-OT Install folder/plugins/org.dita.pdf2/cfg/fo DITA-OT install folder/plugins/com.myplugin.quickstart/cfg/fo
layout-masters-attrs.xsl DITA-OT Install Folder/plugins/org.dita.pdf2/cfg/fo/attrs/ DITA-OT Install Folder/plugins/com.myplugin.quickstart/cfg/fo/attrs

 

Open custom.xsl from <DITA-OT Install Folder>/plugins/myplugin.quickstart/cfg/fo/xsl and add the following line

<xsl:import href=”../layout-master.xsl”/>

Similarly, open custom.xsl from <DITA-OT Install Folder>/plugins/myplugin.quickstart/cfg/fo/attrs and add the following xsl import statement

<xsl:import href=”layout-masters-attrs.xsl”/>

Now, let’s edit layout-masters-attrs.xsl. Open the file using Notepad ++ and locate the attribute set region-body.odd

Add an attribute column-count to region-body.odd attribute set.

 

<xsl:attribute name=”column-count”>2</xsl:attribute>

Now, we need to look for region-body.odd attribute set calls and make changes. You may find yourself searching for specific regions, attribute sets and variable names within various set of xsl files very frequently during the process of creating custom pdf plugins. Using wingrep utility to search within multiple xsl files came very handy here. You may download it from here.

Once wingrep utility is installed, right click on com.myplugin.quickstart folder and select Windows Grep

You will be prompted to enter search criteria

WinGrep5

1 Enter the search string – region-body.odd
2 In the file specification enter *.xsl
3 Locate the plugin folder com.myplugin.quickstart

Windows grep will help you locate exact line numbers where the attribute set is called. You may locate each occurrence one by one.

Hope this will help you quickly edit xsl files while creating custom pdf plugins.

Krishna Meet is a technical writer and UX designer having core interest in analytical dashboard designing. Majority of her career span was into tech-writing. However, she thrives by intersecting multiple skill-sets : DITA documentation, script writing for tech-videos, business analysis, and UX design. She is a voracious reader and possesses Masters degree in Computer Science. Her interest in agile methodologies and user-centered design has landed her a techno-functional role at Brevitaz.

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*